forked from mollie/WooCommerce
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
66 lines (56 loc) · 2.49 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
const Encore = require('@symfony/webpack-encore')
function extractEncoreConfig (name)
{
const config = Encore.getWebpackConfig()
Encore.reset()
return { ...config, name }
}
function configJavaScript ({ basePath })
{
Encore
.setOutputPath(`${basePath}/public/js`)
.setPublicPath('/public/js')
.disableSingleRuntimeChunk()
.addEntry('babel-polyfill.min', '@babel/polyfill')
.addEntry('applepay.min', './resources/js/applepay.js')
.addEntry('applepayDirect.min', './resources/js/applepayDirect.js')
.addEntry('applepayDirectCart.min', './resources/js/applepayDirectCart.js')
.addEntry('paypalButton.min', './resources/js/paypalButton.js')
.addEntry('paypalButtonCart.min', './resources/js/paypalButtonCart.js')
.addEntry('settings.min', './resources/js/settings.js')
.addEntry('gatewaySettings.min', './resources/js/gatewaySettings.js')
.addEntry('advancedSettings.min', './resources/js/advancedSettings.js')
.addEntry('gatewaySurcharge.min', './resources/js/gatewaySurcharge.js')
.addEntry('mollie-components.min', './resources/js/mollie-components.js')
.addEntry('mollie-components-blocks.min', './resources/js/mollie-components-blocks.js')
.addEntry('mollieBlockIndex.min', './resources/js/mollieBlockIndex.js')
.addEntry('paypalButtonBlockComponent.min', './resources/js/paypalButtonBlockComponent.js')
.addEntry('applepayButtonBlockComponent.min', './resources/js/applepayButtonBlockComponent.js')
.enableSourceMaps(!Encore.isProduction())
return extractEncoreConfig('javascript-configuration')
}
function configCss ({ basePath })
{
Encore
.setOutputPath(`${basePath}/public/css`)
.setPublicPath('/public/css')
.disableSingleRuntimeChunk()
.enableSassLoader()
.addStyleEntry('mollie-components.min', './resources/scss/mollie-components.scss')
.addStyleEntry('mollie-gateway-icons.min', './resources/scss/mollie-gateway-icons.scss')
.addStyleEntry('unabledButton.min', './resources/scss/unabledButton.scss')
.addStyleEntry('mollie-applepaydirect.min', './resources/scss/mollie-applepaydirect.scss')
.addStyleEntry('mollie-block-custom-field.min', './resources/scss/mollie-block-custom-field.scss')
.enableSourceMaps(!Encore.isProduction())
return extractEncoreConfig('css-configuration')
}
function config (env)
{
const basePath = process.env.BASE_PATH || '.';
const config = [
configJavaScript({basePath}),
configCss({basePath})
]
return [...config]
}
module.exports = env => config(env)