-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.js
More file actions
40 lines (38 loc) · 1.17 KB
/
webpack.config.js
File metadata and controls
40 lines (38 loc) · 1.17 KB
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
const CopyWebpackPlugin = require('copy-webpack-plugin')
const CssMinimizerPlugin = require('css-minimizer-webpack-plugin')
const TerserPlugin = require('terser-webpack-plugin')
const path = require('path')
const CODICON_PATH = '@vscode/codicons/dist/'
module.exports = (env, argv) => {
const { devtool, mode} = argv
console.log('🥼🥼', 'MODE -->', mode, '🥼🥼')
return {
target: 'node',
mode,
devtool,
entry: './src/extension.js',
output: {
filename: 'extension.js',
libraryTarget: 'commonjs2', // important
path: path.resolve(__dirname, 'dist')
},
externals: {
vscode: 'commonjs vscode'
},
plugins: [
new CopyWebpackPlugin({
patterns: [
{ from: require.resolve(`${CODICON_PATH}/codicon.css`) },
{ from: require.resolve(`${CODICON_PATH}/codicon.ttf`) },
{ from: 'src/controller.js' },
{ from: 'src/index.pug' },
{ from: 'src/style.css' }
]
})
],
optimization: {
minimize: mode === 'production',
minimizer: mode === 'production' ? [new TerserPlugin({ extractComments: false }), new CssMinimizerPlugin()] : []
}
}
}