-
Notifications
You must be signed in to change notification settings - Fork 7
/
webpack.config.js
58 lines (57 loc) · 1.33 KB
/
webpack.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
const path = require('path');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const TerserPlugin = require("terser-webpack-plugin");
/**
* @type {import('webpack').Configuration}
*/
module.exports = (env, options) => {
const isProd = options.mode === 'production';
return {
target: 'node',
mode: 'none',
entry: {
app: path.join(__dirname, 'src/app', 'index.tsx'),
extension: path.join(__dirname, 'src', 'extension.ts')
},
resolve: {
extensions: ['.ts', '.tsx', '.js', '.jsx', '.css', '.less'],
},
externals: {
vscode: 'commonjs vscode',
},
devtool: 'nosources-source-map',
optimization: {
minimize: isProd,
},
module: {
rules: [
{
test: /\.tsx?$/,
use: 'ts-loader',
exclude: '/node_modules/',
},
{
test: /\.css$/,
use: ['style-loader', 'css-loader'],
},
{
test: /\.less?$/,
use: ['style-loader', 'css-loader', 'less-loader'],
},
],
},
output: {
filename: '[name].js',
path: path.resolve(__dirname, 'dist'),
libraryTarget: 'commonjs2'
},
optimization: {
minimizer: [new TerserPlugin({
parallel: true,
})],
},
plugins: [
new CleanWebpackPlugin(),
]
}
};