Use webpack bundler
This commit is contained in:
@@ -8,6 +8,8 @@ src/**
|
|||||||
**/.eslintrc.json
|
**/.eslintrc.json
|
||||||
**/*.map
|
**/*.map
|
||||||
**/*.ts
|
**/*.ts
|
||||||
|
out/**
|
||||||
|
webpack.config.js
|
||||||
.replit
|
.replit
|
||||||
.breakpoints
|
.breakpoints
|
||||||
.local/**
|
.local/**
|
||||||
|
|||||||
13
package.json
13
package.json
@@ -12,7 +12,7 @@
|
|||||||
"Other"
|
"Other"
|
||||||
],
|
],
|
||||||
"activationEvents": [],
|
"activationEvents": [],
|
||||||
"main": "./out/extension.js",
|
"main": "./dist/extension.js",
|
||||||
"contributes": {
|
"contributes": {
|
||||||
"commands": [
|
"commands": [
|
||||||
{
|
{
|
||||||
@@ -68,9 +68,11 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"vscode:prepublish": "npm run compile",
|
"vscode:prepublish": "npm run webpack:prod",
|
||||||
|
"webpack:dev": "webpack --mode development",
|
||||||
|
"webpack:prod": "webpack --mode production",
|
||||||
"compile": "tsc -p ./",
|
"compile": "tsc -p ./",
|
||||||
"watch": "tsc -watch -p ./",
|
"watch": "webpack --watch --mode development",
|
||||||
"pretest": "npm run compile && npm run lint",
|
"pretest": "npm run compile && npm run lint",
|
||||||
"lint": "eslint src",
|
"lint": "eslint src",
|
||||||
"test": "vscode-test"
|
"test": "vscode-test"
|
||||||
@@ -84,7 +86,10 @@
|
|||||||
"@vscode/test-cli": "^0.0.10",
|
"@vscode/test-cli": "^0.0.10",
|
||||||
"@vscode/test-electron": "^2.4.1",
|
"@vscode/test-electron": "^2.4.1",
|
||||||
"eslint": "^9.21.0",
|
"eslint": "^9.21.0",
|
||||||
"typescript": "^5.7.3"
|
"ts-loader": "^9.5.2",
|
||||||
|
"typescript": "^5.7.3",
|
||||||
|
"webpack": "^5.98.0",
|
||||||
|
"webpack-cli": "^6.0.1"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@vscode/vsce": "^3.2.2",
|
"@vscode/vsce": "^3.2.2",
|
||||||
|
|||||||
18
tsconfig.webpack.json
Normal file
18
tsconfig.webpack.json
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
{
|
||||||
|
"extends": "./tsconfig.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"module": "commonjs",
|
||||||
|
"target": "ES2020",
|
||||||
|
"outDir": "dist",
|
||||||
|
"sourceMap": true,
|
||||||
|
"esModuleInterop": true
|
||||||
|
},
|
||||||
|
"exclude": [
|
||||||
|
"node_modules",
|
||||||
|
"src/test/**",
|
||||||
|
"**/*.test.ts"
|
||||||
|
],
|
||||||
|
"include": [
|
||||||
|
"src/**/*.ts"
|
||||||
|
]
|
||||||
|
}
|
||||||
46
webpack.config.js
Normal file
46
webpack.config.js
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
const path = require('path');
|
||||||
|
const webpack = require('webpack');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @type {import('webpack').Configuration}
|
||||||
|
*/
|
||||||
|
const config = {
|
||||||
|
target: 'node',
|
||||||
|
mode: 'none', // Set to 'production' for minified output
|
||||||
|
|
||||||
|
entry: {
|
||||||
|
main: './src/extension.ts'
|
||||||
|
},
|
||||||
|
output: {
|
||||||
|
path: path.resolve(__dirname, 'dist'),
|
||||||
|
filename: 'extension.js',
|
||||||
|
libraryTarget: 'commonjs2',
|
||||||
|
devtoolModuleFilenameTemplate: '../[resource-path]'
|
||||||
|
},
|
||||||
|
devtool: 'source-map',
|
||||||
|
externals: {
|
||||||
|
vscode: 'commonjs vscode' // The vscode module is created on-the-fly and must be excluded
|
||||||
|
},
|
||||||
|
resolve: {
|
||||||
|
extensions: ['.ts', '.js']
|
||||||
|
},
|
||||||
|
module: {
|
||||||
|
rules: [
|
||||||
|
{
|
||||||
|
test: /\.ts$/,
|
||||||
|
exclude: /node_modules|src\/test/,
|
||||||
|
use: [
|
||||||
|
{
|
||||||
|
loader: 'ts-loader',
|
||||||
|
options: {
|
||||||
|
transpileOnly: true,
|
||||||
|
configFile: path.resolve(__dirname, './tsconfig.webpack.json')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = config;
|
||||||
Reference in New Issue
Block a user