Use webpack.

This commit is contained in:
CismonX 2020-11-02 15:10:13 +08:00
parent 43e1e63bf8
commit 59168bf3bf
Signed by: cismonx
GPG Key ID: 3094873E29A482FB
4 changed files with 1286 additions and 12 deletions

1234
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -16,24 +16,27 @@
"icon": "assets/texinfo.png",
"devDependencies": {
"@types/node": "^14.14.6",
"@types/terser-webpack-plugin": "^5.0.1",
"@types/vscode": "^1.50.0",
"@types/webpack": "^4.41.24",
"@typescript-eslint/eslint-plugin": "^3.8.0",
"@typescript-eslint/parser": "^3.8.0",
"cson": "^7.20.0",
"eslint": "^7.12.1",
"language-texinfo": "^1.0.0",
"typescript": "^4.0.5"
},
"dependencies": {
"node-html-parser": "^1.4.3"
"node-html-parser": "^1.4.5",
"ts-loader": "^8.0.7",
"ts-node": "^9.0.0",
"typescript": "^4.0.5",
"webpack": "^5.3.2",
"webpack-cli": "^4.1.0"
},
"scripts": {
"vscode:prepublish": "npm run lint && npm run build",
"compile": "tsc -p ./",
"vscode:prepublish": "webpack --mode production",
"build": "webpack --mode development",
"prepare": "sh ./scripts/prepare.sh",
"build": "npm run prepare && npm run compile",
"lint": "eslint --ext ts --fix src",
"watch": "tsc -watch -p ./"
"watch": "webpack --mode development --watch"
},
"eslintConfig": {
"root": true,

View File

@ -6,6 +6,7 @@
"lib": [
"ES2019"
],
"esModuleInterop": true,
"strictNullChecks": true,
"sourceMap": true,
"rootDir": "src",
@ -14,6 +15,6 @@
},
"exclude": [
"node_modules",
".vscode-test"
"*.config.ts"
]
}

42
webpack.config.ts Normal file
View File

@ -0,0 +1,42 @@
import * as path from 'path';
import * as webpack from 'webpack';
const config: webpack.Configuration = {
target: 'node',
entry: './src/extension.ts',
output: {
path: path.resolve(__dirname, 'out'),
filename: 'extension.js',
libraryTarget: 'commonjs2',
devtoolModuleFilenameTemplate: '../[resource-path]',
},
devtool: 'source-map',
optimization: {
concatenateModules: true,
innerGraph: true,
mergeDuplicateChunks: true,
mangleExports: true,
minimize: true,
},
externals: {
vscode: 'commonjs vscode',
},
resolve: {
extensions: ['.js', '.ts'],
},
module: {
rules: [
{
test: /\.ts$/,
exclude: /node_modules/,
use: [
{
loader: 'ts-loader',
},
],
},
],
},
};
export default config;