-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathwebpack.config.js
More file actions
55 lines (43 loc) · 1.62 KB
/
webpack.config.js
File metadata and controls
55 lines (43 loc) · 1.62 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
const Encore = require('@symfony/webpack-encore');
const path = require('path');
const fs = require('fs');
const uiBundleScripts = path.resolve(__dirname, '../../sylius/sylius/src/Sylius/Bundle/UiBundle/Resources/private/js/');
const basePath = path.resolve(__dirname, './');
const assets_path = path.join(basePath, './src/Resources/private');
const output_path = path.join(basePath, './src/Resources/public');
const public_path = 'bundles/asdoriasyliusconfiguratorplugin';
const sass_path = path.join(assets_path, './sass');
const js_path = path.join(assets_path, './js');
const isProduction = Encore.isProduction();
Encore
// empty the outputPath dir cd ../before each build
.cleanupOutputBeforeBuild()
// directory where all compiled assets will be stored
.setOutputPath(output_path)
.setPublicPath('/' + public_path)
.setManifestKeyPrefix(public_path)
.addEntry('shop-configurator', [
path.join(js_path, './shop.js'),
path.join(sass_path, './shop.scss'),
])
.addEntry('admin-configurator', [
path.join(js_path, './admin.js'),
path.join(sass_path, './admin.scss'),
])
// allow sass/scss files to be processed
.enableSassLoader()
// .enablePostCssLoader()
// allow legacy applications to use $/jQuery as a global variable
.autoProvidejQuery()
.enableSourceMaps(!isProduction)
.disableSingleRuntimeChunk()
// create hashed filenames (e.g. app.abc123.css)
.enableVersioning(isProduction)
.configureFilenames({
js: '[name].min.js',
css: '[name].min.css',
})
;
const config = Encore.getWebpackConfig();
config.resolve.alias['sylius/ui'] = uiBundleScripts;
module.exports = config;