-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathwebpack.config.js
42 lines (40 loc) · 1.24 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
/**
* This configuration file is used by webpack to build irma project. It build all js files
* into one, inserts final "irma.js" into "index.html", created source-map file and put all
* files into "dist" folder.
*
* @author flatline
*/
const path = require('path');
const Cleaner = require('clean-webpack-plugin');
/**
* {String} Determine development mode. Possible values: 'development', 'production'.
* In package.json may be set as parameter: npx webpack --mode=development
*/
const NODE_ENV = process.env.NODE_ENV ? process.env.NODE_ENV : 'development';
/**
* {Boolean} Means development mode. In this mode we have to suppress code minification
* and add source maps into it for debug
*/
const DEV_MODE = NODE_ENV === 'development';
module.exports = {
mode : NODE_ENV,
entry : './src/Main.js',
//
// We do not need watching at all
//
watch : false,
devtool: DEV_MODE ? 'source-map' : 'source-map', // 'source-map' doesn't work with karma
module : {
rules: [
{test: /\.html$/, use: 'ignore-loader'}
]
},
plugins: [
new Cleaner(['./dist/*.js', './dist/*.map'])
],
output : {
filename: 'irma.js',
path : path.resolve(__dirname, './dist')
}
}