This commit is contained in:
全卓 2022-10-11 18:06:36 +08:00
parent cb0ccc155c
commit 664d2c0804
4 changed files with 1944 additions and 2 deletions

1
.gitignore vendored
View File

@ -5,3 +5,4 @@ node_modules
*.vsix *.vsix
syntaxes/*.json syntaxes/*.json
tsconfig.tsbuildinfo tsconfig.tsbuildinfo
server/src/*.d.ts

1878
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -108,6 +108,9 @@
"scripts": { "scripts": {
"vscode:prepublish": "npm run compile", "vscode:prepublish": "npm run compile",
"compile": "npm run grammar && tsc -b . --verbose", "compile": "npm run grammar && tsc -b . --verbose",
"webpack": "webpack --mode development",
"webpack-dev": "webpack --mode development --watch",
"package": "webpack --mode production --devtool hidden-source-map",
"watch": "npm run grammar && tsc -watch -b . --verbose", "watch": "npm run grammar && tsc -watch -b . --verbose",
"pretest": "npm run compile && npm run lint", "pretest": "npm run compile && npm run lint",
"lint": "eslint src --ext ts", "lint": "eslint src --ext ts",
@ -126,6 +129,9 @@
"eslint": "^8.20.0", "eslint": "^8.20.0",
"js-yaml": "^4.1.0", "js-yaml": "^4.1.0",
"mocha": "^10.0.0", "mocha": "^10.0.0",
"typescript": "^4.8.4" "ts-loader": "^9.4.1",
"typescript": "^4.8.4",
"webpack": "^5.74.0",
"webpack-cli": "^4.10.0"
} }
} }

59
webpack.config.js Normal file
View File

@ -0,0 +1,59 @@
//@ts-check
'use strict';
const path = require('path');
const webpack = require('webpack');
/**@type {import('webpack').Configuration}*/
const config = {
target: 'node', // vscode extensions run in webworker context for VS Code web 📖 -> https://webpack.js.org/configuration/target/#target
// entry: {
// client: './client/src/extension.ts',
// server: './server/src/server.ts'
// }, // the entry point of this extension, 📖 -> https://webpack.js.org/configuration/entry-context/
entry: "./server/src/server.ts",
// entry: "./client/src/extension.ts",
output: {
// the bundle is stored in the 'dist' folder (check package.json), 📖 -> https://webpack.js.org/configuration/output/
path: path.resolve(__dirname, 'dist'),
filename: '[name].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. Add other modules that cannot be webpack'ed, 📖 -> https://webpack.js.org/configuration/externals/
},
resolve: {
// support reading TypeScript and JavaScript files, 📖 -> https://github.com/TypeStrong/ts-loader
mainFields: ['browser', 'module', 'main'], // look for `browser` entry point in imported node modules
extensions: ['.ts', '.js'],
alias: {
// provides alternate implementation for node module and source files
},
fallback: {
// Webpack 5 no longer polyfills Node.js core modules automatically.
// see https://webpack.js.org/configuration/resolve/#resolvefallback
// for the list of Node.js core module polyfills.
}
},
module: {
rules: [
{
test: /\.ts$/,
exclude: /node_modules/,
use: [
{
loader: 'ts-loader',
options: {
"projectReferences": true
}
}
]
}
]
}
};
module.exports = config;