-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwebpack.config.js
executable file
·50 lines (44 loc) · 1.19 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
const Encore = require('@symfony/webpack-encore'),
CompressionPlugin = require('compression-webpack-plugin'),
config = require('./webpack-config.json');
Encore.setOutputPath(config.outputPath)
.setPublicPath(config.publicPath)
.cleanupOutputBeforeBuild()
.autoProvidejQuery()
.enableSassLoader()
.enableSourceMaps(!Encore.isProduction())
.enableVersioning(true);
Object.keys(config.scripts).forEach(key => {
let script = config.scripts[key];
Encore
.addEntry(script.dest, script.src);
});
Object.keys(config.styles).forEach(key => {
let style = config.styles[key];
Encore
.addStyleEntry(style.dest, style.src);
});
Encore
.copyFiles({
from: config.copy.from,
to: config.copy.to
})
.disableSingleRuntimeChunk()
.configureBabel(() => {}, {
useBuiltIns: 'usage',
corejs: 3,
exclude: /node_modules/
})
.enableBuildNotifications();
if (Encore.isProduction()) {
Encore
.addPlugin(
new CompressionPlugin({
algorithm: 'gzip',
test: /\.(js|css)$/
}),
10
)
;
}
module.exports = Encore.getWebpackConfig();