-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
executable file
·56 lines (44 loc) · 1.35 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
const Encore = require('@symfony/webpack-encore');
const webpack = require('webpack');
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
if (!Encore.isRuntimeEnvironmentConfigured()) {
Encore.configureRuntimeEnvironment(process.env.NODE_ENV || 'dev');
}
Encore.setOutputPath('./public/assets')
.setPublicPath('/assets')
.addEntry('global', './assets/global.js')
.addEntry('login', './assets/login.js')
.addEntry('vue', './assets/vue/index.js')
.enableStimulusBridge('./assets/controllers.json')
.splitEntryChunks()
.enableSingleRuntimeChunk()
.cleanupOutputBeforeBuild()
.enableBuildNotifications()
.enableSourceMaps(!Encore.isProduction())
.enableVersioning(Encore.isProduction())
.configureBabelPresetEnv((config) => {
config.useBuiltIns = 'usage';
config.corejs = '3.23';
})
.configureBabel((babelConfig) => {
babelConfig.plugins = ['@babel/plugin-transform-runtime'];
})
.enableEslintPlugin()
.enableSassLoader()
.enableVueLoader(() => {}, { runtimeCompilerBuild: false, version: 3 });
if (!Encore.isProduction()) {
Encore.addPlugin(
new BundleAnalyzerPlugin({
analyzerMode: 'static',
reportFilename: 'report.html',
openAnalyzer: false,
}),
);
}
Encore.addPlugin(
new webpack.DefinePlugin({
__VUE_OPTIONS_API__: false,
__VUE_PROD_DEVTOOLS__: true,
}),
);
module.exports = Encore.getWebpackConfig();