-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwebpack.config.js
50 lines (40 loc) · 1.13 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
var Encore = require('@symfony/webpack-encore')
Encore
.setOutputPath('public/build/')
.setPublicPath('/build')
.setManifestKeyPrefix('public/')
.addEntry('app', './assets/js/app.js')
.addEntry('admin', './assets/js/admin.js')
.cleanupOutputBeforeBuild()
.enableSourceMaps(!Encore.isProduction())
// enables hashed filenames (e.g. app.abc123.css)
.enableVersioning(Encore.isProduction())
// enables Sass/SCSS support
.enableSassLoader(function (options) {
// https://github.com/sass/node-sass#options
// options.includePaths = [...]
}, {
// set optional Encore-specific options
resolveUrlLoader: false
})
.autoProvidejQuery()
.enableSingleRuntimeChunk()
.splitEntryChunks()
.configureTerserPlugin((options) => {
if (Encore.isProduction()) {
options.terserOptions = {
compress: {
drop_console: true
}
}
}
})
// Retrieve the config
const config = Encore.getWebpackConfig()
// Change the kind of source map generated in
// development mode
if (!Encore.isProduction()) {
config.devtool = 'eval-source-map'
}
// Export the config
module.exports = config