Repository navigation
Expand file tree
/
Copy pathwebpack.config.js
More file actions
executable file
·69 lines (58 loc) · 1.72 KB
/
Copy pathwebpack.config.js
File metadata and controls
executable file
·69 lines (58 loc) · 1.72 KB
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
60
61
62
63
64
65
66
67
68
69
const Encore = require('@symfony/webpack-encore');
const webpack = require('webpack');
const ESLintPlugin = require('eslint-webpack-plugin');
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'];
})
.enableSassLoader((options) => {
options.sassOptions = {
silenceDeprecations: ['import', 'legacy-js-api', 'slash-div', 'if-function'],
};
options.warnRuleAsWarning = false;
})
.enableVueLoader(() => {}, { runtimeCompilerBuild: false, version: 3 });
if (!Encore.isProduction()) {
Encore.addPlugin(
new ESLintPlugin({
extensions: ['js', 'vue'],
files: 'assets/',
exclude: ['node_modules', 'public'],
emitWarning: true,
failOnError: false,
}),
);
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();