50 lines
1007 B
JavaScript
50 lines
1007 B
JavaScript
|
//@ts-check
|
||
|
|
||
|
'use strict';
|
||
|
|
||
|
const path = require('path');
|
||
|
const webpack = require('webpack');
|
||
|
|
||
|
/**@type {import('webpack').Configuration}*/
|
||
|
const config = {
|
||
|
target: 'node', // vscode扩展运行在Node.js环境中
|
||
|
entry: './src/extension.ts', // 入口文件
|
||
|
output: {
|
||
|
path: path.resolve(__dirname, 'dist'),
|
||
|
filename: 'extension.js',
|
||
|
libraryTarget: 'commonjs2',
|
||
|
devtoolModuleFilenameTemplate: '../[resource-path]'
|
||
|
},
|
||
|
devtool: 'source-map',
|
||
|
externals: {
|
||
|
vscode: 'commonjs vscode' // vscode-module是vscode提供的
|
||
|
},
|
||
|
resolve: {
|
||
|
extensions: ['.ts', '.js'],
|
||
|
fallback: {
|
||
|
bufferutil: false,
|
||
|
'utf-8-validate': false,
|
||
|
},
|
||
|
},
|
||
|
module: {
|
||
|
rules: [
|
||
|
{
|
||
|
test: /\.ts$/,
|
||
|
exclude: /node_modules/,
|
||
|
use: [
|
||
|
{
|
||
|
loader: 'ts-loader'
|
||
|
}
|
||
|
]
|
||
|
}
|
||
|
]
|
||
|
},
|
||
|
plugins: [
|
||
|
new webpack.IgnorePlugin({
|
||
|
resourceRegExp: /^bufferutil$|^utf-8-validate$/
|
||
|
})
|
||
|
]
|
||
|
};
|
||
|
|
||
|
module.exports = config;
|