forked from kimai/kimai
-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.config.js
62 lines (52 loc) · 1.78 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
// Hint: if something doesn't work as expected: yarn upgrade --latest
const Encore = require('@symfony/webpack-encore');
Encore
.setOutputPath('public/build/')
.setPublicPath('/build/')
.setManifestKeyPrefix('build/')
.cleanupOutputBeforeBuild()
.addEntry('app', './assets/app.js')
.addEntry('export-pdf', './assets/export-pdf.js')
.addEntry('invoice', './assets/invoice.js')
.addEntry('invoice-pdf', './assets/invoice-pdf.js')
.addEntry('chart', './assets/chart.js')
.addEntry('calendar', './assets/calendar.js')
.addEntry('dashboard', './assets/dashboard.js')
.splitEntryChunks()
.configureSplitChunks(function(splitChunks) {
splitChunks.chunks = 'async';
})
// in the past there was a bug with empty hashes in entrypoints.json, disable if it happens again
.enableIntegrityHashes(Encore.isProduction())
.enableSingleRuntimeChunk()
.enableVersioning(Encore.isProduction())
.enableSourceMaps(!Encore.isProduction())
.enableBuildNotifications()
.enableSassLoader(function(sassOptions) {}, {
resolveUrlLoader: false
})
.configureCssMinimizerPlugin((options) => {
options.minimizerOptions = {
preset: ['default', { discardComments: { removeAll: true } }],
}
})
// compress javascript in production build
.configureTerserPlugin((options) => {
options.terserOptions = {
compress: true,
output: {
comments: false,
},
// chart.js will fail if sources are mangled
/*
mangle: {
properties: {
regex: /^_/,
},
},
*/
}
})
.enableEslintPlugin()
;
module.exports = Encore.getWebpackConfig();