forked from kobotoolbox/kpi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprod.config.js
47 lines (45 loc) · 1.21 KB
/
prod.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
const fs = require('fs');
const path = require('path');
const webpack = require('webpack');
const BundleTracker = require('webpack-bundle-tracker');
const publicPath = (process.env.KPI_PREFIX === '/' ? '' : (process.env.KPI_PREFIX || '')) + '/static/compiled/';
const WebpackCommon = require('./webpack.common');
const outputPath = path.resolve(__dirname, '../jsapp/compiled/');
// ExtractTranslationKeysPlugin, for one, just fails if this directory doesn't exist
fs.mkdirSync(outputPath, {recursive: true});
module.exports = WebpackCommon({
mode: 'production',
optimization: {
splitChunks: {
cacheGroups: {
commons: {
test: /[\\/]node_modules[\\/]/,
name: 'vendors',
chunks: 'all'
}
}
}
},
entry: {
app: './jsapp/js/main.es6',
browsertests: path.resolve(__dirname, '../test/index.js')
},
output: {
path: outputPath,
publicPath: publicPath,
filename: '[name]-[hash].js'
},
plugins: [
new webpack.SourceMapDevToolPlugin({
filename: '[file].map',
exclude: /vendors.*.*/
})
],
// mainly for hiding stylelint output
stats: {
all: false,
maxModules: 0,
errors: true,
errorDetails: true
}
});