-
Notifications
You must be signed in to change notification settings - Fork 5
/
webpack.config.js
45 lines (37 loc) · 1.03 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
const Encore = require('@symfony/webpack-encore');
const path = require('path');
const libAssets = path.resolve(__dirname, 'assets/js/lib');
Encore
// directory where compiled assets will be stored
.setOutputPath('src/Resources/public')
// public path used by the web server to access the output path
.setPublicPath('/public')
// entries
.addEntry('advanced-shipping', './assets/js/app.js')
// copy images
.copyFiles({
from: './assets/images',
to: 'images/[path][name].[ext]',
includeSubdirectories: true,
pattern: /\.(png|jpg|jpeg|svg)$/
})
// configuration
.disableSingleRuntimeChunk()
.cleanupOutputBeforeBuild()
.enableSourceMaps(!Encore.isProduction())
.enableVersioning(Encore.isProduction())
// organise files
.configureFilenames({
js: 'js/[name].js',
css: 'css/[name].css',
})
.configureImageRule({
type: 'asset',
filename: `images/[name].[ext]`,
})
;
const config = Encore.getWebpackConfig();
config.resolve.alias = {
'@lib': libAssets,
};
module.exports = config;