forked from kimai/kimai
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
67 lines (58 loc) · 1.94 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
// 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('app-rtl', './assets/app-rtl.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((splitChunks) => {
splitChunks.chunks = 'async';
})
.enableSingleRuntimeChunk()
.configureBabel((config) => {
config.sourceType = 'unambiguous';
config.plugins.push('@babel/plugin-syntax-dynamic-import');
})
.configureBabelPresetEnv((config) => {
config.useBuiltIns = 'usage';
config.corejs = 3;
config.targets = {};
config.modules = false;
})
.enableIntegrityHashes(Encore.isProduction())
.enableVersioning(Encore.isProduction())
.enableSourceMaps(!Encore.isProduction())
.enableSassLoader((options) => {})
.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: /^_/,
},
},
*/
}
})
;
module.exports = Encore.getWebpackConfig();