-
Notifications
You must be signed in to change notification settings - Fork 339
/
webpack.config.js
47 lines (36 loc) · 1.53 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
const path = require('path');
const Encore = require('@symfony/webpack-encore');
const SyliusAdmin = require('@sylius-ui/admin');
const SyliusShop = require('@sylius-ui/shop');
// Admin config
const adminConfig = SyliusAdmin.getWebpackConfig(path.resolve(__dirname));
// Shop config
const shopConfig = SyliusShop.getWebpackConfig(path.resolve(__dirname));
// App shop config
Encore
.setOutputPath('public/build/app/shop')
.setPublicPath('/build/app/shop')
.addEntry('app-shop-entry', './assets/shop/entrypoint.js')
.disableSingleRuntimeChunk()
.cleanupOutputBeforeBuild()
.enableSourceMaps(!Encore.isProduction())
.enableVersioning(Encore.isProduction())
.enableSassLoader();
const appShopConfig = Encore.getWebpackConfig();
appShopConfig.externals = Object.assign({}, appShopConfig.externals, { window: 'window', document: 'document' });
appShopConfig.name = 'app.shop';
Encore.reset();
// App admin config
Encore
.setOutputPath('public/build/app/admin')
.setPublicPath('/build/app/admin')
.addEntry('app-admin-entry', './assets/admin/entrypoint.js')
.disableSingleRuntimeChunk()
.cleanupOutputBeforeBuild()
.enableSourceMaps(!Encore.isProduction())
.enableVersioning(Encore.isProduction())
.enableSassLoader();
const appAdminConfig = Encore.getWebpackConfig();
appAdminConfig.externals = Object.assign({}, appAdminConfig.externals, { window: 'window', document: 'document' });
appAdminConfig.name = 'app.admin';
module.exports = [shopConfig, adminConfig, appShopConfig, appAdminConfig];