forked from kimai/kimai
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
59 lines (46 loc) · 1.64 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
// Hint: if something doesn't work as expected: yarn upgrade --latest
var Encore = require('@symfony/webpack-encore');
var webpack = require('webpack');
Encore
.setOutputPath('public/build/')
.setPublicPath('build/')
.setManifestKeyPrefix('build/')
.cleanupOutputBeforeBuild()
.addEntry('app', './assets/app.js')
.addEntry('chart', './assets/chart.js')
.addEntry('calendar', './assets/calendar.js')
.copyFiles({ from: './assets/images', to: 'images/[path][name].[ext]' })
.splitEntryChunks()
.enableSingleRuntimeChunk()
.enableIntegrityHashes()
.enableVersioning(Encore.isProduction())
.enableSourceMaps(!Encore.isProduction())
.enableBuildNotifications()
.enableSassLoader()
.autoProvidejQuery()
// prevent that moment locales will be included which we don't need
.addPlugin(new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/))
.configureBabel(null, {
useBuiltIns: 'usage',
corejs: 3,
})
.configureOptimizeCssPlugin((options) => {
options.cssProcessorPluginOptions = {
preset: ['default', { discardComments: { removeAll: true } }],
}
})
.configureTerserPlugin((options) => {
options.cache = true;
options.terserOptions = {
output: {
comments: false
}
}
})
;
var config = Encore.getWebpackConfig();
// this is a hack based on https://github.com/symfony/webpack-encore/issues/88
// to rewrite the font url() in CSS to be relative.
// if you encounter any problems ... please let me know!
config.module.rules[3].options.publicPath = './';
module.exports = config;