From f044c4770a35ab17b17ff484e68b463916542d91 Mon Sep 17 00:00:00 2001 From: Levi Yan Date: Tue, 2 Jul 2024 12:31:42 +0800 Subject: [PATCH] refactor: use webpack to compile and package --- .vscode/launch.json | 2 +- package.json | 14 ++++---------- webpack.config.js | 8 ++++---- 3 files changed, 9 insertions(+), 15 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index 1167fa0..e7bec1c 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -7,7 +7,7 @@ "type": "extensionHost", "request": "launch", "args": ["--extensionDevelopmentPath=${workspaceRoot}"], - "preLaunchTask": "tsc: build - tsconfig.json", + "sourceMaps": true, "outFiles": ["${workspaceFolder}/dist/**/*.js"], }, { diff --git a/package.json b/package.json index 4a1c2d7..eb1d190 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/webpack.config.js b/webpack.config.js index b15e3f9..f291b19 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -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'] } }; \ No newline at end of file