refactor: use webpack to compile and package

This commit is contained in:
Levi Yan
2024-07-02 12:31:42 +08:00
parent fd9fe52529
commit f044c4770a
3 changed files with 9 additions and 15 deletions

2
.vscode/launch.json vendored
View File

@@ -7,7 +7,7 @@
"type": "extensionHost",
"request": "launch",
"args": ["--extensionDevelopmentPath=${workspaceRoot}"],
"preLaunchTask": "tsc: build - tsconfig.json",
"sourceMaps": true,
"outFiles": ["${workspaceFolder}/dist/**/*.js"],
},
{

View File

@@ -90,17 +90,11 @@
}
},
"scripts": {
"build": "webpack --mode production",
"compile": "webpack --mode production",
"vscode:package": "webpack --mode production && vsce package",
"vscode:prepublish": "npm run package",
"compile": "webpack",
"watch": "webpack --watch",
"package": "webpack --mode production --devtool hidden-source-map",
"compile-tests": "tsc -p . --outDir out",
"watch-tests": "tsc -p . -w --outDir out",
"pretest": "npm run compile-tests && npm run compile && npm run lint",
"lint": "eslint src --ext ts",
"test": "vscode-test"
"vscode:publish": "vsce publish",
"watch": "webpack --mode production --watch",
"lint": "eslint src --ext ts"
},
"dependencies": {
"fs-plus": "~3.1.1",

View File

@@ -15,7 +15,7 @@ externals.push('vscode');
module.exports = {
mode: 'production',
entry: __dirname + '/src/main.js',
entry: __dirname + '/src/main.ts',
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'extension.js',
@@ -27,14 +27,14 @@ module.exports = {
module: {
rules: [
{
test: /\.js$/,
loader: 'babel-loader',
test: /\.ts$/,
loader: 'ts-loader',
exclude: /node_modules/
}
]
},
resolve: {
modules: [path.resolve('./node_modules'), path.resolve('./src')],
extensions: ['.js']
extensions: ['.ts', '.js']
}
};