This repository was archived by the owner on Aug 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathwebpack.config.js
72 lines (68 loc) · 2.16 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
const Encore = require('@symfony/webpack-encore');
const WorkboxPlugin = require('workbox-webpack-plugin');
const FaviconsWebpackPlugin = require('favicons-webpack-plugin');
if (!Encore.isRuntimeEnvironmentConfigured()) {
Encore.configureRuntimeEnvironment(process.env.NODE_ENV || 'dev');
}
Encore
.setOutputPath('public/build/')
.setPublicPath('/build')
.addEntry('app', './assets/js/app.js')
.splitEntryChunks()
.enableSingleRuntimeChunk()
.cleanupOutputBeforeBuild()
.enableBuildNotifications()
.enableLessLoader()
.enableSourceMaps(!Encore.isProduction())
.enableVersioning(Encore.isProduction())
.configureBabelPresetEnv((config) => {
config.useBuiltIns = 'usage';
config.corejs = 3;
})
.configureBabel(function (babelConfig) {
babelConfig.plugins.push("@babel/plugin-proposal-class-properties");
})
.addLoader({
test: /\.html$/i,
loader: 'html-loader',
options: {
esModule: false
}
})
.disableFontsLoader()
.addLoader({
test: /\.(svg|ttf|eot|png|woff(2)?)(\?[a-z0-9]+)?$/,
use: [{
loader: 'file-loader',
options: {
esModule: false
}
}]
})
.addPlugin(
new FaviconsWebpackPlugin({
logo: './assets/img/logo.svg',
mode: 'webapp', // optional can be 'webapp' or 'light' - 'webapp' by default
devMode: 'webapp', // optional can be 'webapp' or 'light' - 'light' by default
cache: false,
favicons: {
appName: 'Cloud Explorer',
appDescription: 'Access your iCloud data.',
developerName: 'Bitter Digital Solutions Ltd.',
developerURL: "https://www.bitter.de",
background: '#fff',
theme_color: '#333'
}
})
)
.addPlugin(
new WorkboxPlugin.GenerateSW({
clientsClaim: true,
skipWaiting: true
})
)
;
Encore.configureLoaderRule('images', loaderRule => {
loaderRule.test = /\.(png|jpg|jpeg|gif|ico|webp)$/;
});
module.exports = Encore.getWebpackConfig();