woocommerce/plugins/woocommerce-blocks/webpack.config.js

114 lines
2.2 KiB
JavaScript

/**
* Internal dependencies
*/
const { NODE_ENV, getAlias } = require( './bin/webpack-helpers.js' );
const {
getCoreConfig,
getMainConfig,
getFrontConfig,
getPaymentsConfig,
getExtensionsConfig,
getSiteEditorConfig,
getStylingConfig,
getInteractivityAPIConfig,
getCartAndCheckoutFrontendConfig,
} = require( './bin/webpack-configs.js' );
// Only options shared between all configs should be defined here.
const sharedConfig = {
mode: NODE_ENV,
performance: {
hints: false,
},
stats: {
all: false,
assets: true,
builtAt: true,
colors: true,
errors: true,
hash: true,
timings: true,
},
watchOptions: {
ignored: /node_modules/,
},
devtool: NODE_ENV === 'development' ? 'source-map' : false,
};
const CartAndCheckoutFrontendConfig = {
...sharedConfig,
...getCartAndCheckoutFrontendConfig( { alias: getAlias() } ),
};
// Core config for shared libraries.
const CoreConfig = {
...sharedConfig,
...getCoreConfig( { alias: getAlias() } ),
};
// Main Blocks config for registering Blocks and for the Editor.
const MainConfig = {
...sharedConfig,
...getMainConfig( {
alias: getAlias(),
} ),
};
// Frontend config for scripts used in the store itself.
const FrontendConfig = {
...sharedConfig,
...getFrontConfig( { alias: getAlias() } ),
};
/**
* Config for building experimental extension scripts.
*/
const ExtensionsConfig = {
...sharedConfig,
...getExtensionsConfig( { alias: getAlias() } ),
};
/**
* Config for building the payment methods integration scripts.
*/
const PaymentsConfig = {
...sharedConfig,
...getPaymentsConfig( { alias: getAlias() } ),
};
/**
* Config to generate the CSS files.
*/
const StylingConfig = {
...sharedConfig,
...getStylingConfig( { alias: getAlias() } ),
};
/**
* Config to generate the Interactivity API runtime.
*/
const InteractivityConfig = {
...sharedConfig,
...getInteractivityAPIConfig( { alias: getAlias() } ),
};
/**
* Config to generate the site editor scripts.
*/
const SiteEditorConfig = {
...sharedConfig,
...getSiteEditorConfig( { alias: getAlias() } ),
};
module.exports = [
CartAndCheckoutFrontendConfig,
CoreConfig,
MainConfig,
FrontendConfig,
ExtensionsConfig,
PaymentsConfig,
SiteEditorConfig,
StylingConfig,
InteractivityConfig,
];