2023-03-31 17:36:40 +00:00
|
|
|
/**
|
|
|
|
* External dependencies
|
|
|
|
*/
|
|
|
|
const CopyWebpackPlugin = require( 'copy-webpack-plugin' );
|
|
|
|
const path = require( 'path' );
|
|
|
|
const RemoveEmptyScriptsPlugin = require( 'webpack-remove-empty-scripts' );
|
|
|
|
const WebpackRTLPlugin = require( 'webpack-rtl-plugin' );
|
|
|
|
|
2023-01-31 13:38:28 +00:00
|
|
|
/**
|
|
|
|
* Internal dependencies
|
|
|
|
*/
|
2024-02-27 08:07:53 +00:00
|
|
|
const {
|
|
|
|
webpackConfig,
|
Update to pnpm 9.1 (#47385)
* Update to pnpm 9.1 and fix a mini css bug
* Add changefile(s) from automation for the following project(s): @woocommerce/tracks, @woocommerce/product-editor, @woocommerce/onboarding, @woocommerce/number, @woocommerce/notices, @woocommerce/navigation, @woocommerce/internal-js-tests, @woocommerce/extend-cart-checkout-block, @woocommerce/expression-evaluation, @woocommerce/explat, @woocommerce/experimental, @woocommerce/eslint-plugin, @woocommerce/dependency-extraction-webpack-plugin, @woocommerce/date, @woocommerce/data, @woocommerce/customer-effort-score, @woocommerce/currency, @woocommerce/csv-export, @woocommerce/create-woo-extension, @woocommerce/create-product-editor-block, @woocommerce/components, @woocommerce/api, @woocommerce/ai, @woocommerce/admin-e2e-tests, woocommerce-blocks, woocommerce-beta-tester, woocommerce, woo-ai
* temporarily disable swallowing build output to diagnose issue with perf workflow
* Ignore some type issues that commonly resurface when deps slightly change
* Fix persistent type issues that have recurred many times
* Add more ignores
* Fix lint issue
* Revert change to swallow build error
* Improve access of the config that needs updated build dir.
---------
Co-authored-by: github-actions <github-actions@github.com>
2024-05-13 13:57:39 +00:00
|
|
|
plugin,
|
2024-02-27 08:07:53 +00:00
|
|
|
StyleAssetPlugin,
|
|
|
|
} = require( '@woocommerce/internal-style-build' );
|
2023-03-31 17:36:40 +00:00
|
|
|
const {
|
|
|
|
blockEntryPoints,
|
|
|
|
getBlockMetaData,
|
|
|
|
getEntryPointName,
|
|
|
|
} = require( './config/block-entry-points' );
|
|
|
|
|
|
|
|
const NODE_ENV = process.env.NODE_ENV || 'development';
|
2023-01-31 13:38:28 +00:00
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
mode: process.env.NODE_ENV || 'development',
|
|
|
|
entry: {
|
|
|
|
'build-style': __dirname + '/src/style.scss',
|
2023-03-31 17:36:40 +00:00
|
|
|
...blockEntryPoints,
|
2023-01-31 13:38:28 +00:00
|
|
|
},
|
|
|
|
output: {
|
|
|
|
path: __dirname,
|
|
|
|
},
|
|
|
|
module: {
|
2023-03-27 01:42:33 +00:00
|
|
|
parser: webpackConfig.parser,
|
2023-01-31 13:38:28 +00:00
|
|
|
rules: webpackConfig.rules,
|
|
|
|
},
|
2023-03-31 17:36:40 +00:00
|
|
|
plugins: [
|
|
|
|
new RemoveEmptyScriptsPlugin(),
|
Update to pnpm 9.1 (#47385)
* Update to pnpm 9.1 and fix a mini css bug
* Add changefile(s) from automation for the following project(s): @woocommerce/tracks, @woocommerce/product-editor, @woocommerce/onboarding, @woocommerce/number, @woocommerce/notices, @woocommerce/navigation, @woocommerce/internal-js-tests, @woocommerce/extend-cart-checkout-block, @woocommerce/expression-evaluation, @woocommerce/explat, @woocommerce/experimental, @woocommerce/eslint-plugin, @woocommerce/dependency-extraction-webpack-plugin, @woocommerce/date, @woocommerce/data, @woocommerce/customer-effort-score, @woocommerce/currency, @woocommerce/csv-export, @woocommerce/create-woo-extension, @woocommerce/create-product-editor-block, @woocommerce/components, @woocommerce/api, @woocommerce/ai, @woocommerce/admin-e2e-tests, woocommerce-blocks, woocommerce-beta-tester, woocommerce, woo-ai
* temporarily disable swallowing build output to diagnose issue with perf workflow
* Ignore some type issues that commonly resurface when deps slightly change
* Fix persistent type issues that have recurred many times
* Add more ignores
* Fix lint issue
* Revert change to swallow build error
* Improve access of the config that needs updated build dir.
---------
Co-authored-by: github-actions <github-actions@github.com>
2024-05-13 13:57:39 +00:00
|
|
|
new plugin( {
|
2023-03-31 17:36:40 +00:00
|
|
|
filename: ( data ) => {
|
|
|
|
return data.chunk.name.startsWith( '/build/blocks' )
|
|
|
|
? `[name].css`
|
|
|
|
: `[name]/style.css`;
|
|
|
|
},
|
|
|
|
chunkFilename: 'chunks/[id].style.css',
|
|
|
|
} ),
|
|
|
|
new WebpackRTLPlugin( {
|
|
|
|
test: /(?<!style)\.css$/,
|
|
|
|
filename: '[name]-rtl.css',
|
|
|
|
minify: NODE_ENV === 'development' ? false : { safe: true },
|
|
|
|
} ),
|
|
|
|
new WebpackRTLPlugin( {
|
|
|
|
test: /style\.css$/,
|
|
|
|
filename: '[name]/style-rtl.css',
|
|
|
|
minify: NODE_ENV === 'development' ? false : { safe: true },
|
|
|
|
} ),
|
|
|
|
new CopyWebpackPlugin( {
|
|
|
|
patterns: [
|
|
|
|
{
|
|
|
|
from: './src/**/block.json',
|
|
|
|
to( { absoluteFilename } ) {
|
|
|
|
const blockMetaData = getBlockMetaData(
|
|
|
|
path.resolve( __dirname, absoluteFilename )
|
|
|
|
);
|
|
|
|
const entryPointName = getEntryPointName(
|
|
|
|
absoluteFilename,
|
|
|
|
blockMetaData
|
|
|
|
);
|
|
|
|
return `./${ entryPointName }`;
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
} ),
|
2024-02-27 08:07:53 +00:00
|
|
|
new StyleAssetPlugin(),
|
2023-03-31 17:36:40 +00:00
|
|
|
],
|
2023-01-31 13:38:28 +00:00
|
|
|
};
|