-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwebpack.config.js
51 lines (48 loc) · 1.09 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
let path = require('path');
let MinifyPlugin = require('babel-minify-webpack-plugin');
module.exports = env => {
const isProd = env !== 'development';
const plugins = [];
if (isProd) {
plugins.push(new MinifyPlugin(undefined, { include: /\.min\.js$/ }));
}
const runtimeEntry = path.resolve(__dirname, 'src/handlebars-inc-runtime.js');
let entry;
if (isProd) {
entry = {
'handlebars-inc-runtime.min': runtimeEntry,
'handlebars-inc-runtime': runtimeEntry,
};
} else {
entry = {
'handlebars-inc-runtime.development': runtimeEntry,
};
}
return {
mode: isProd ? 'production' : 'development',
output: {
path: path.resolve(__dirname, 'dist'),
filename: '[name].js',
},
entry,
module: {
rules: [
{
test: /\.(js|ts)$/,
exclude: /node_modules/,
loader: 'babel-loader',
options: {
envName: 'runtime',
},
},
],
},
resolve: {
extensions: ['.ts', '.js'],
},
optimization: {
minimize: false,
},
plugins,
};
};