forked from ProtonMail/WebClients
-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.config.js
68 lines (62 loc) · 1.95 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
59
60
61
62
63
64
65
66
67
68
const path = require('path');
const glob = require('glob');
const CONFIG = require('./env/conf.build');
const env = require('./env/config');
const makeSRC = (list) => list.map((file) => path.resolve(file));
const TEMPLATES_GLOB = makeSRC(glob.sync('./src/templates/**/*.tpl.html'));
const CSS_GLOB = makeSRC(CONFIG.vendor_files.css);
const BUILD_TARGET = !env.isDistRelease() ? 'build' : 'dist';
// const BUILD_TARGET = 'build';
/**
* Some plugins are broken -> uglifyJS
* And don't catch their errors, we need to see them
* tada !!
*/
process.on('unhandledRejection', (reason, p) => {
console.log('Position', p);
console.log('Reason', reason);
});
module.exports = {
stats: 'minimal',
devtool: !env.isDistRelease() ? 'cheap-module-eval-source-map' : false, // Done via UglifyJS
mode: !env.isDistRelease() ? 'development' : 'production',
watchOptions: {
ignored: [/node_modules/, 'i18n/*.json', /\*\.(gif|jpeg|jpg|ico|png)/]
},
devServer: {
hot: true,
stats: 'minimal',
host: '0.0.0.0',
port: process.env.NODE_ENV_PORT,
public: 'localhost',
historyApiFallback: true,
disableHostCheck: true,
contentBase: path.resolve('./build')
},
entry: {
app: ['./src/app/app.js'],
appLazy: ['./src/app/appLazy.js'],
html: './src/app.html'
},
resolve: {
unsafeCache: true,
symlinks: false,
alias: {
sass: path.resolve('./src/sass'),
assets: path.resolve('./src/assets')
}
},
output: {
path: path.resolve(`./${BUILD_TARGET}`),
filename: '[name].js'
},
module: {
rules: [
...require('./webpack.tasks/js.loader'),
...require('./webpack.tasks/css.loader'),
...require('./webpack.tasks/templates.loader'),
...require('./webpack.tasks/assets.loader')
]
},
plugins: require('./webpack.tasks/plugins')
};