2021-02-10 03:24:42 +00:00
|
|
|
/* eslint-disable @typescript-eslint/no-var-requires */
|
|
|
|
/* eslint-disable @typescript-eslint/no-require-imports */
|
|
|
|
|
2019-07-24 13:49:01 +00:00
|
|
|
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
|
2019-04-21 18:30:00 +00:00
|
|
|
const TerserPlugin = require('terser-webpack-plugin');
|
2020-12-20 11:16:48 +00:00
|
|
|
const path = require('path');
|
2019-04-21 18:30:00 +00:00
|
|
|
|
2021-02-10 03:24:42 +00:00
|
|
|
/** @type {import('webpack').Configuration} */
|
2019-04-21 18:30:00 +00:00
|
|
|
module.exports = {
|
|
|
|
target: 'node',
|
|
|
|
entry: './src/extension.ts',
|
|
|
|
output: {
|
|
|
|
filename: 'extension.js',
|
2019-09-22 16:56:19 +00:00
|
|
|
libraryTarget: 'commonjs2',
|
2020-12-20 11:16:48 +00:00
|
|
|
path: path.resolve(process.cwd(), 'dist'),
|
2019-04-21 18:30:00 +00:00
|
|
|
},
|
|
|
|
devtool: 'source-map',
|
|
|
|
externals: {
|
2019-09-22 16:56:19 +00:00
|
|
|
vscode: 'commonjs vscode',
|
2019-04-21 18:30:00 +00:00
|
|
|
},
|
|
|
|
resolve: {
|
2019-09-22 16:56:19 +00:00
|
|
|
extensions: ['.ts', '.js', '.json'],
|
2019-04-21 18:30:00 +00:00
|
|
|
},
|
2019-09-22 16:56:19 +00:00
|
|
|
plugins: [new CleanWebpackPlugin()],
|
2019-04-21 18:30:00 +00:00
|
|
|
optimization: {
|
2020-12-20 11:16:48 +00:00
|
|
|
minimize: true,
|
2019-04-21 18:30:00 +00:00
|
|
|
minimizer: [
|
|
|
|
new TerserPlugin({
|
2019-08-03 12:16:17 +00:00
|
|
|
extractComments: true,
|
2019-04-21 18:30:00 +00:00
|
|
|
terserOptions: {
|
2020-12-20 11:16:48 +00:00
|
|
|
output: {
|
|
|
|
comments: false,
|
|
|
|
},
|
2019-08-03 12:16:17 +00:00
|
|
|
mangle: false,
|
|
|
|
keep_classnames: true,
|
2019-09-22 16:56:19 +00:00
|
|
|
keep_fnames: true,
|
|
|
|
},
|
|
|
|
}),
|
|
|
|
],
|
2019-04-21 18:30:00 +00:00
|
|
|
},
|
|
|
|
module: {
|
2019-09-22 16:56:19 +00:00
|
|
|
rules: [
|
|
|
|
{
|
|
|
|
test: /\.ts$/,
|
|
|
|
use: 'ts-loader',
|
|
|
|
exclude: /node_modules/,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
2019-04-21 18:30:00 +00:00
|
|
|
};
|