-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
/
webpack.config.js
72 lines (60 loc) · 1.73 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
/*!
* This file is part of the Sonata Project package.
*
* (c) Thomas Rabaix <thomas.rabaix@sonata-project.org>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
const Encore = require('@symfony/webpack-encore');
const StyleLintPlugin = require('stylelint-webpack-plugin');
Encore.setOutputPath('./src/Resources/public')
.setPublicPath('.')
.setManifestKeyPrefix('bundles/sonataadmin')
.cleanupOutputBeforeBuild()
.enableSassLoader()
.enablePostCssLoader()
.enableVersioning(false)
.enableSourceMaps(false)
.enableEslintPlugin()
.autoProvidejQuery()
.disableSingleRuntimeChunk()
.enableStimulusBridge('./assets/js/controllers.json')
.configureCssMinimizerPlugin((options) => {
options.minimizerOptions = {
preset: ['default', { discardComments: { removeAll: true } }],
};
})
.configureImageRule({
filename: 'images/[name][ext]',
})
.configureFontRule({
filename: 'fonts/[name][ext]',
})
.addPlugin(
new StyleLintPlugin({
context: 'assets/scss',
emitWarning: true,
})
)
.configureTerserPlugin((options) => {
options.terserOptions = {
output: { comments: false },
};
options.extractComments = false;
})
.copyFiles([
{ from: './assets/images/', pattern: /\.(png|gif)$/, to: 'images/[name].[ext]' },
{
from: './node_modules/admin-lte/dist/css/skins/',
pattern: /skin-.*\.min.css/,
to: 'admin-lte-skins/[name].[ext]',
},
{
from: './node_modules/select2/dist/js/i18n/',
pattern: /\.js/,
to: 'select2-locale/[name].[ext]',
},
])
.addEntry('app', './assets/js/app.js');
module.exports = Encore.getWebpackConfig();