all: bundle with esbuild instead of webpack
Bundling with esbuild is considerably faster than with webpack: on my PC, webpack takes ~8.5 seconds and esbuild takes ~50 milliseconds. Fixes golang/vscode-go#1705 Change-Id: If3df213195fb56f652a09135ef5f8b438060f16a Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/343791 Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com> TryBot-Result: kokoro <noreply+kokoro@google.com> Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com> Trust: Hyang-Ah Hana Kim <hyangah@gmail.com> Trust: Suzy Mueller <suzmue@golang.org>
This commit is contained in:
Родитель
83aa2cb694
Коммит
3f434bd52f
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"recommendations": ["connor4312.esbuild-problem-matchers"]
|
||||
}
|
|
@ -25,7 +25,7 @@
|
|||
"stopOnEntry": false,
|
||||
"sourceMaps": true,
|
||||
"smartStep": true,
|
||||
"preLaunchTask": "npm: webpack",
|
||||
"preLaunchTask": "npm: bundle-dev",
|
||||
"env": {
|
||||
"VSCODE_GO_IN_TEST": "" // Enable code
|
||||
},
|
||||
|
@ -44,7 +44,7 @@
|
|||
],
|
||||
"sourceMaps": true,
|
||||
"smartStep": true,
|
||||
"preLaunchTask": "npm: webpack"
|
||||
"preLaunchTask": "npm: bundle-dev"
|
||||
},
|
||||
{
|
||||
"name": "Launch Extension Tests",
|
||||
|
|
|
@ -50,6 +50,22 @@
|
|||
"kind": "build",
|
||||
"isDefault": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "npm",
|
||||
"script": "bundle-watch",
|
||||
"group": "build",
|
||||
"problemMatcher": "$esbuild-watch",
|
||||
"isBackground": true,
|
||||
"presentation": {
|
||||
"reveal": "never"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "npm",
|
||||
"script": "bundle-dev",
|
||||
"group": "build",
|
||||
"problemMatcher": "$esbuild",
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -18,4 +18,3 @@ third_party/
|
|||
tools/
|
||||
tsconfig.json
|
||||
typings/
|
||||
webpack.config.js
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
10
package.json
10
package.json
|
@ -35,10 +35,11 @@
|
|||
],
|
||||
"scripts": {
|
||||
"vscode:prepublish": "npm run compile",
|
||||
"webpack": "webpack --mode development",
|
||||
"webpack-dev": "webpack --mode development --watch",
|
||||
"bundle": "esbuild src/goMain.ts debugAdapter=src/debugAdapter/goDebug.ts --bundle --outdir=dist --external:vscode --format=cjs --platform=node",
|
||||
"bundle-dev": "npm run bundle -- --sourcemap",
|
||||
"bundle-watch": "npm run bundle -- --sourcemap --watch",
|
||||
"test-compile": "tsc -p ./",
|
||||
"compile": "webpack --mode production",
|
||||
"compile": "npm run bundle -- --minify",
|
||||
"watch": "tsc -watch -p ./",
|
||||
"test": "npm run test-compile && node ./out/test/runTest.js",
|
||||
"lint": "gts lint src test",
|
||||
|
@ -73,6 +74,7 @@
|
|||
"@types/sinon": "^9.0.0",
|
||||
"@types/vscode": "^1.59.0",
|
||||
"adm-zip": "^0.4.14",
|
||||
"esbuild": "^0.12.21",
|
||||
"fs-extra": "^9.0.0",
|
||||
"get-port": "^5.1.1",
|
||||
"gts": "^3.1.0",
|
||||
|
@ -83,8 +85,6 @@
|
|||
"tslint": "^6.1.1",
|
||||
"typescript": "^3.8.3",
|
||||
"vscode-test": "^1.3.0",
|
||||
"webpack": "^5.27.2",
|
||||
"webpack-cli": "^4.5.0",
|
||||
"yarn": "^1.22.4"
|
||||
},
|
||||
"engines": {
|
||||
|
|
|
@ -1,47 +0,0 @@
|
|||
//@ts-check
|
||||
|
||||
'use strict';
|
||||
|
||||
const path = require('path');
|
||||
|
||||
/**@type {import('webpack').Configuration}*/
|
||||
const config = {
|
||||
target: 'node',
|
||||
entry: {
|
||||
goMain: './src/goMain.ts',
|
||||
debugAdapter: './src/debugAdapter/goDebug.ts',
|
||||
},
|
||||
output: {
|
||||
path: path.resolve(__dirname, 'dist'),
|
||||
filename: '[name].js',
|
||||
libraryTarget: 'commonjs2',
|
||||
devtoolModuleFilenameTemplate: '../[resource-path]',
|
||||
sourceMapFilename: '[name].js.map'
|
||||
},
|
||||
devtool: 'source-map',
|
||||
externals: {
|
||||
// the vscode-module is created on-the-fly and must be excluded.
|
||||
vscode: 'commonjs vscode'
|
||||
},
|
||||
resolve: {
|
||||
extensions: ['.ts', '.js']
|
||||
},
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.ts$/,
|
||||
exclude: /node_modules/,
|
||||
use: [
|
||||
{
|
||||
loader: 'ts-loader'
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
optimization: {
|
||||
// when this is true, the debugger breaks...
|
||||
minimize: false
|
||||
},
|
||||
};
|
||||
module.exports = config;
|
Загрузка…
Ссылка в новой задаче