-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
53 lines (42 loc) · 1.87 KB
/
index.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
const path = require('path');
const Encore = require('@symfony/webpack-encore');
class CommerceWeaversSyliusTpay {
static getWebpackShopConfig(rootDir) {
Encore
.setOutputPath('public/build/commerce-weavers/tpay/shop')
.setPublicPath('/build/commerce-weavers/tpay/shop')
.addEntry('commerce-weavers-sylius-tpay-shop-checkout-complete-entry', path.resolve(__dirname, 'assets/shop/checkout_complete_entrypoint.js'))
.addEntry('commerce-weavers-sylius-tpay-shop-order-show-entry', path.resolve(__dirname, 'assets/shop/order_show_entrypoint.js'))
.disableSingleRuntimeChunk()
.cleanupOutputBeforeBuild()
.enableSourceMaps(!Encore.isProduction())
.enableVersioning(Encore.isProduction())
.enableSassLoader((options) => {
// eslint-disable-next-line no-param-reassign
options.additionalData = `$rootDir: ${rootDir};`;
})
const shopConfig = Encore.getWebpackConfig();
shopConfig.name = 'commerce_weavers_sylius_tpay_shop';
Encore.reset();
return shopConfig;
}
static getWebpackAdminConfig(rootDir) {
Encore
.setOutputPath('public/build/commerce-weavers/tpay/admin')
.setPublicPath('/build/commerce-weavers/tpay/admin')
.addEntry('commerce-weavers-sylius-tpay-admin-payment-method-entry', path.resolve(__dirname, 'assets/admin/payment_method_entrypoint.js'))
.disableSingleRuntimeChunk()
.cleanupOutputBeforeBuild()
.enableSourceMaps(!Encore.isProduction())
.enableVersioning(Encore.isProduction())
.enableSassLoader((options) => {
// eslint-disable-next-line no-param-reassign
options.additionalData = `$rootDir: ${rootDir};`;
})
const adminConfig = Encore.getWebpackConfig();
adminConfig.name = 'commerce_weavers_sylius_tpay_admin';
Encore.reset();
return adminConfig;
}
}
module.exports = CommerceWeaversSyliusTpay;