-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathwebpack.config.js
46 lines (40 loc) · 1.19 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
const path = require('path');
const webpack = require('webpack');
const {getIfUtils, removeEmpty} = require('webpack-config-utils');
// variables
const outPath = path.join(__dirname);
const assetsPath = path.join(__dirname, 'assets');
// plugins
const HtmlWebpackPlugin = require('html-webpack-plugin');
const htmlTemplate = path.join(assetsPath, 'template.html');
module.exports = env => {
const {ifNotProd} = getIfUtils(env || {});
// get boolean value to use directly in flag configuration;
const isNotProd = ifNotProd(true, false);
return {
devtool: 'eval',
entry: removeEmpty({
main: path.join(__dirname, 'scripts', 'bin', 'app', 'kickstart.js'),
}),
output: {
path: outPath,
filename: '[name].bundle.js',
pathinfo: isNotProd,
publicPath: '/'
},
module: {
noParse: [/\.min\.js$/, /\.bundle\.js$/],
rules: []
},
resolve: {
extensions: ['.ts', '.tsx', '.js'],
// Fix webpack's default behavior to not load packages with jsnext:main module
// (jsnext:main directs not usually distributable es6 format, but es6 sources)
mainFields: ['module', 'browser', 'main']
},
target: 'web',
plugins: [new HtmlWebpackPlugin({
template: htmlTemplate,
})]
};
};