webpack v5
This commit is contained in:
parent
00734145cd
commit
98f4f4ba74
4 changed files with 32 additions and 7 deletions
3
.vscode/launch.json
vendored
3
.vscode/launch.json
vendored
|
@ -9,13 +9,14 @@
|
||||||
"name": "Run Extension",
|
"name": "Run Extension",
|
||||||
"type": "extensionHost",
|
"type": "extensionHost",
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
|
"sourceMaps": true,
|
||||||
"args": [
|
"args": [
|
||||||
"--extensionDevelopmentPath=${workspaceFolder}"
|
"--extensionDevelopmentPath=${workspaceFolder}"
|
||||||
],
|
],
|
||||||
"outFiles": [
|
"outFiles": [
|
||||||
"${workspaceFolder}/dist/**/*.js"
|
"${workspaceFolder}/dist/**/*.js"
|
||||||
],
|
],
|
||||||
"preLaunchTask": "${defaultBuildTask}"
|
"preLaunchTask": "${defaultBuildTask}",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Extension Tests",
|
"name": "Extension Tests",
|
||||||
|
|
7
.vscode/tasks.json
vendored
7
.vscode/tasks.json
vendored
|
@ -28,6 +28,13 @@
|
||||||
"reveal": "never"
|
"reveal": "never"
|
||||||
},
|
},
|
||||||
"group": "build"
|
"group": "build"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "npm",
|
||||||
|
"script": "pretest",
|
||||||
|
"problemMatcher": [],
|
||||||
|
"label": "npm: pretest",
|
||||||
|
"detail": "npm run test-compile && npm run lint"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
|
@ -14,7 +14,10 @@
|
||||||
// "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
|
// "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
|
||||||
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
|
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
|
||||||
// "noUnusedParameters": true, /* Report errors on unused parameters. */
|
// "noUnusedParameters": true, /* Report errors on unused parameters. */
|
||||||
"experimentalDecorators": true
|
"experimentalDecorators": true,
|
||||||
|
"types": [
|
||||||
|
"node"
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"exclude": [
|
"exclude": [
|
||||||
"node_modules",
|
"node_modules",
|
||||||
|
|
|
@ -2,10 +2,16 @@
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
const NodePolyfillPlugin = require("node-polyfill-webpack-plugin");
|
||||||
|
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
const webpack = require('webpack');
|
||||||
|
|
||||||
/**@type {import('webpack').Configuration}*/
|
/**@type {import('webpack').Configuration}*/
|
||||||
const config = {
|
const config = {
|
||||||
|
node: {
|
||||||
|
__dirname: true
|
||||||
|
},
|
||||||
target: 'node', // vscode extensions run in a Node.js-context 📖 -> https://webpack.js.org/configuration/node/
|
target: 'node', // vscode extensions run in a Node.js-context 📖 -> https://webpack.js.org/configuration/node/
|
||||||
mode: 'none', // this leaves the source code as close as possible to the original (when packaging we set this to 'production')
|
mode: 'none', // this leaves the source code as close as possible to the original (when packaging we set this to 'production')
|
||||||
|
|
||||||
|
@ -14,16 +20,24 @@ const config = {
|
||||||
// the bundle is stored in the 'dist' folder (check package.json), 📖 -> https://webpack.js.org/configuration/output/
|
// the bundle is stored in the 'dist' folder (check package.json), 📖 -> https://webpack.js.org/configuration/output/
|
||||||
path: path.resolve(__dirname, 'dist'),
|
path: path.resolve(__dirname, 'dist'),
|
||||||
filename: 'extension.js',
|
filename: 'extension.js',
|
||||||
libraryTarget: 'commonjs2'
|
libraryTarget: 'commonjs2',
|
||||||
|
devtoolModuleFilenameTemplate: '../[resource-path]'
|
||||||
},
|
},
|
||||||
devtool: 'nosources-source-map',
|
devtool: 'eval-source-map',
|
||||||
externals: {
|
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/
|
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: {
|
resolve: {
|
||||||
|
// mainFields: ['browser', 'module', 'main'],
|
||||||
// support reading TypeScript and JavaScript files, 📖 -> https://github.com/TypeStrong/ts-loader
|
// support reading TypeScript and JavaScript files, 📖 -> https://github.com/TypeStrong/ts-loader
|
||||||
extensions: ['.ts', '.js']
|
extensions: ['.ts', '.js'],
|
||||||
|
fallback: {
|
||||||
|
"fs": false
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
plugins: [
|
||||||
|
new NodePolyfillPlugin()
|
||||||
|
],
|
||||||
module: {
|
module: {
|
||||||
rules: [
|
rules: [
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue