2018-11-13 19:12:32 +00:00
|
|
|
/**
|
2020-07-07 09:05:06 +00:00
|
|
|
* Internal dependencies
|
2018-11-13 19:12:32 +00:00
|
|
|
*/
|
2019-10-06 12:36:15 +00:00
|
|
|
const FallbackModuleDirectoryPlugin = require( './bin/fallback-module-directory-webpack-plugin' );
|
2022-01-28 11:40:23 +00:00
|
|
|
const { NODE_ENV, getAlias } = require( './bin/webpack-helpers.js' );
|
2019-10-06 12:36:15 +00:00
|
|
|
const {
|
2020-07-07 09:05:06 +00:00
|
|
|
getCoreConfig,
|
2019-10-06 12:36:15 +00:00
|
|
|
getMainConfig,
|
|
|
|
getFrontConfig,
|
2020-07-07 09:05:06 +00:00
|
|
|
getPaymentsConfig,
|
2021-03-16 11:40:22 +00:00
|
|
|
getExtensionsConfig,
|
2020-07-22 12:05:56 +00:00
|
|
|
getStylingConfig,
|
2020-07-07 09:05:06 +00:00
|
|
|
} = require( './bin/webpack-configs.js' );
|
2019-02-19 21:09:36 +00:00
|
|
|
|
2020-07-07 09:05:06 +00:00
|
|
|
// Only options shared between all configs should be defined here.
|
|
|
|
const sharedConfig = {
|
2019-07-22 09:39:00 +00:00
|
|
|
mode: NODE_ENV,
|
|
|
|
performance: {
|
|
|
|
hints: false,
|
|
|
|
},
|
|
|
|
stats: {
|
|
|
|
all: false,
|
|
|
|
assets: true,
|
|
|
|
builtAt: true,
|
|
|
|
colors: true,
|
|
|
|
errors: true,
|
|
|
|
hash: true,
|
|
|
|
timings: true,
|
|
|
|
},
|
2019-10-28 11:00:04 +00:00
|
|
|
watchOptions: {
|
|
|
|
ignored: /node_modules/,
|
|
|
|
},
|
2022-01-28 14:34:36 +00:00
|
|
|
devtool: NODE_ENV === 'development' ? 'source-map' : false,
|
2019-08-22 20:56:47 +00:00
|
|
|
};
|
|
|
|
|
2020-07-07 09:05:06 +00:00
|
|
|
// Core config for shared libraries.
|
2019-08-22 20:56:47 +00:00
|
|
|
const CoreConfig = {
|
2020-07-07 09:05:06 +00:00
|
|
|
...sharedConfig,
|
|
|
|
...getCoreConfig( { alias: getAlias() } ),
|
2019-07-22 09:39:00 +00:00
|
|
|
};
|
|
|
|
|
2020-07-07 09:05:06 +00:00
|
|
|
// Main Blocks config for registering Blocks and for the Editor.
|
|
|
|
const MainConfig = {
|
|
|
|
...sharedConfig,
|
2020-03-31 10:46:38 +00:00
|
|
|
...getMainConfig( {
|
|
|
|
alias: getAlias(),
|
|
|
|
} ),
|
2019-10-06 12:36:15 +00:00
|
|
|
};
|
|
|
|
|
2020-07-07 09:05:06 +00:00
|
|
|
// Frontend config for scripts used in the store itself.
|
|
|
|
const FrontendConfig = {
|
|
|
|
...sharedConfig,
|
2019-10-28 13:53:09 +00:00
|
|
|
...getFrontConfig( { alias: getAlias() } ),
|
|
|
|
};
|
|
|
|
|
2021-03-16 11:40:22 +00:00
|
|
|
/**
|
|
|
|
* Config for building experimental extension scripts.
|
|
|
|
*/
|
|
|
|
const ExtensionsConfig = {
|
|
|
|
...sharedConfig,
|
|
|
|
...getExtensionsConfig( { alias: getAlias() } ),
|
|
|
|
};
|
|
|
|
|
2019-10-28 13:53:09 +00:00
|
|
|
/**
|
2020-08-25 10:01:19 +00:00
|
|
|
* Config for building the payment methods integration scripts.
|
2019-10-28 13:53:09 +00:00
|
|
|
*/
|
2020-07-07 09:05:06 +00:00
|
|
|
const PaymentsConfig = {
|
|
|
|
...sharedConfig,
|
|
|
|
...getPaymentsConfig( { alias: getAlias() } ),
|
|
|
|
};
|
2019-10-28 13:53:09 +00:00
|
|
|
|
2020-07-22 12:05:56 +00:00
|
|
|
/**
|
|
|
|
* Config to generate the CSS files.
|
|
|
|
*/
|
|
|
|
const StylingConfig = {
|
|
|
|
...sharedConfig,
|
|
|
|
...getStylingConfig( { alias: getAlias() } ),
|
|
|
|
};
|
|
|
|
|
2020-07-07 09:05:06 +00:00
|
|
|
/**
|
|
|
|
* Legacy Configs are for builds targeting < WP5.3 and handle backwards compatibility and disabling
|
|
|
|
* unsupported features.
|
2020-08-17 14:20:51 +00:00
|
|
|
*
|
|
|
|
* Now that WordPress 5.5 is released, as of WooCommerce Blocks 3.2.0 we don't support WP <5.3,
|
|
|
|
* so these legacy builds are not used. Keeping the config so we can conveniently reinstate
|
|
|
|
* these builds as needed (hence eslint-disable).
|
2020-07-07 09:05:06 +00:00
|
|
|
*/
|
|
|
|
const LegacyMainConfig = {
|
|
|
|
...sharedConfig,
|
2019-10-06 12:36:15 +00:00
|
|
|
...getMainConfig( {
|
|
|
|
fileSuffix: 'legacy',
|
|
|
|
resolvePlugins: [
|
|
|
|
new FallbackModuleDirectoryPlugin(
|
|
|
|
'/legacy/',
|
|
|
|
'/',
|
|
|
|
getAlias( { pathPart: 'legacy' } )
|
|
|
|
),
|
2018-11-13 19:21:04 +00:00
|
|
|
],
|
2019-11-15 14:41:23 +00:00
|
|
|
exclude: [
|
|
|
|
'all-products',
|
|
|
|
'price-filter',
|
|
|
|
'attribute-filter',
|
2021-08-20 15:56:14 +00:00
|
|
|
'stock-filter',
|
2019-11-15 14:41:23 +00:00
|
|
|
'active-filters',
|
2019-12-09 20:50:49 +00:00
|
|
|
'checkout',
|
|
|
|
'cart',
|
2020-05-27 14:45:18 +00:00
|
|
|
'single-product',
|
2019-11-15 14:41:23 +00:00
|
|
|
],
|
2019-10-06 12:36:15 +00:00
|
|
|
} ),
|
2019-07-22 09:39:00 +00:00
|
|
|
};
|
|
|
|
|
2020-07-07 09:05:06 +00:00
|
|
|
const LegacyFrontendConfig = {
|
|
|
|
...sharedConfig,
|
2019-10-06 12:36:15 +00:00
|
|
|
...getFrontConfig( {
|
|
|
|
fileSuffix: 'legacy',
|
|
|
|
resolvePlugins: [
|
|
|
|
new FallbackModuleDirectoryPlugin(
|
|
|
|
'/legacy/',
|
|
|
|
'/',
|
|
|
|
getAlias( { pathPart: 'legacy' } )
|
|
|
|
),
|
2019-07-22 09:39:00 +00:00
|
|
|
],
|
2019-11-15 14:41:23 +00:00
|
|
|
exclude: [
|
|
|
|
'all-products',
|
|
|
|
'price-filter',
|
|
|
|
'attribute-filter',
|
2021-08-20 15:56:14 +00:00
|
|
|
'stock-filter',
|
2019-11-15 14:41:23 +00:00
|
|
|
'active-filters',
|
2019-12-09 20:50:49 +00:00
|
|
|
'checkout',
|
|
|
|
'cart',
|
2020-05-27 14:45:18 +00:00
|
|
|
'single-product',
|
2019-11-15 14:41:23 +00:00
|
|
|
],
|
2019-10-06 12:36:15 +00:00
|
|
|
} ),
|
2018-02-13 19:03:53 +00:00
|
|
|
};
|
|
|
|
|
2020-07-22 12:05:56 +00:00
|
|
|
const LegacyStylingConfig = {
|
|
|
|
...sharedConfig,
|
|
|
|
...getStylingConfig( {
|
|
|
|
fileSuffix: 'legacy',
|
|
|
|
exclude: [
|
|
|
|
'all-products',
|
|
|
|
'price-filter',
|
|
|
|
'attribute-filter',
|
2021-08-20 15:56:14 +00:00
|
|
|
'stock-filter',
|
2020-07-22 12:05:56 +00:00
|
|
|
'active-filters',
|
|
|
|
'checkout',
|
|
|
|
'cart',
|
|
|
|
'single-product',
|
|
|
|
],
|
|
|
|
} ),
|
|
|
|
};
|
|
|
|
|
2020-08-17 14:20:51 +00:00
|
|
|
/**
|
|
|
|
* Now that WordPress 5.5 is released, as of WooCommerce Blocks 3.2.0 we don't support WP <5.3,
|
|
|
|
* so the legacy builds are not used. Keeping the config so we can conveniently reinstate
|
|
|
|
* these builds as needed (hence eslint-disable).
|
|
|
|
*/
|
|
|
|
// eslint-disable-next-line no-unused-vars
|
|
|
|
const legacyConfigs = [
|
|
|
|
LegacyMainConfig,
|
|
|
|
LegacyFrontendConfig,
|
|
|
|
LegacyStylingConfig,
|
|
|
|
];
|
|
|
|
|
2019-10-06 12:36:15 +00:00
|
|
|
module.exports = [
|
|
|
|
CoreConfig,
|
2020-07-07 09:05:06 +00:00
|
|
|
MainConfig,
|
|
|
|
FrontendConfig,
|
2021-03-16 11:40:22 +00:00
|
|
|
ExtensionsConfig,
|
2020-07-07 09:05:06 +00:00
|
|
|
PaymentsConfig,
|
2020-07-22 12:05:56 +00:00
|
|
|
StylingConfig,
|
2019-10-06 12:36:15 +00:00
|
|
|
];
|