-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
47 lines (43 loc) · 1.42 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
const Encore = require('@symfony/webpack-encore');
if (!Encore.isRuntimeEnvironmentConfigured()) {
Encore.configureRuntimeEnvironment(process.env.NODE_ENV || 'dev');
}
Encore
.setOutputPath('public/build/')
.setPublicPath('/build')
.addEntry('app', '/assets/js/theme.js')
.copyFiles({
from: "./assets/img/",
to: "[path][name].[hash:8].[ext]",
context: "./assets"
})
.splitEntryChunks()
// enables the Symfony UX Stimulus bridge (used in assets/bootstrap.js)
.enableStimulusBridge('./assets/controllers.json')
.enableSingleRuntimeChunk()
.enableBuildNotifications()
.enableSourceMaps(!Encore.isProduction())
.enableVersioning(Encore.isProduction())
.enableStimulusBridge('./assets/json/controllers.json')
.enableSassLoader(() => {
}, {
resolveUrlLoader: false
})
// .enableTypeScriptLoader()
.enablePostCssLoader()
.configureBabelPresetEnv((configuration) => {
configuration.useBuiltIns = 'usage';
configuration.corejs = '3.30';
})
.configureBabel((configuration) => {
configuration.plugins.push('@babel/plugin-proposal-class-properties')
})
.configureTerserPlugin((configuration) => {
configuration.extractComments = false;
})
.configureImageRule({
filename: "img/[name].[hash:8][ext]",
})
.cleanupOutputBeforeBuild()
;
module.exports = Encore.getWebpackConfig();