Monorepo: actualize loaders paths filtering for better Webpack performance. (#49714)

This commit is contained in:
Vladimir Reznichenko 2024-07-29 15:20:17 +02:00 committed by GitHub
parent a8b560a03f
commit 07a71106dc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 35 additions and 14 deletions

View File

@ -21,7 +21,11 @@ module.exports = {
rules: [
{
test: /\.s?css$/,
exclude: [ /storybook\/wordpress/, /build-style\/*\/*.css/ ],
exclude: [
/storybook\/wordpress/,
/build-style\/*\/*.css/,
/[\/\\](changelog|bin|docs|build|build-module|build-types|vendor|tests|test)[\/\\]/,
],
use: [
MiniCssExtractPlugin.loader,
'css-loader',

View File

@ -0,0 +1,4 @@
Significance: patch
Type: dev
Monorepo: tweak Webpack loaders paths filtering for better build perfromance.

View File

@ -1,5 +1,6 @@
const defaultConfig = require( '@wordpress/scripts/config/webpack.config' );
const WooCommerceDependencyExtractionWebpackPlugin = require( '@woocommerce/dependency-extraction-webpack-plugin' );
const path = require( 'path' );
module.exports = {
...defaultConfig,
@ -13,7 +14,7 @@ module.exports = {
{
test: /\.tsx?$/,
use: 'ts-loader',
exclude: /node_modules/,
include: [ path.resolve( __dirname, './src/' ) ],
},
{
test: /\.(png|jp(e*)g|svg|gif)$/,

View File

@ -126,8 +126,8 @@ const webpackConfig = {
amd: false,
},
exclude: [
// Exclude node_modules/.pnpm
/node_modules(\/|\\)\.pnpm(\/|\\)/,
/[\/\\]node_modules[\/\\]\.pnpm[\/\\]/,
/[\/\\](changelog|bin|build|docs|test)[\/\\]/,
],
use: {
loader: 'babel-loader',

View File

@ -0,0 +1,4 @@
Significance: patch
Type: dev
Monorepo: tweak Webpack loaders paths filtering for better build perfromance.

View File

@ -1,5 +1,6 @@
const defaultConfig = require( '@wordpress/scripts/config/webpack.config' );
const WooCommerceDependencyExtractionWebpackPlugin = require( '@woocommerce/dependency-extraction-webpack-plugin' );
const path = require( 'path' );
module.exports = {
...defaultConfig,
@ -15,7 +16,7 @@ module.exports = {
{
test: /\.tsx?$/,
use: 'ts-loader',
exclude: /node_modules/,
include: [ path.resolve( __dirname, './src/' ) ],
},
],
},

View File

@ -43,7 +43,7 @@ const getSharedPlugins = ( {
[
CHECK_CIRCULAR_DEPS === 'true' && checkCircularDeps !== false
? new CircularDependencyPlugin( {
exclude: /node_modules/,
exclude: [ /[\/\\](node_modules|build|docs|vendor)[\/\\]/ ],
cwd: process.cwd(),
failOnError: 'warn',
} )
@ -94,7 +94,9 @@ const getCoreConfig = ( options = {} ) => {
rules: [
{
test: /\.(t|j)sx?$/,
exclude: /node_modules/,
exclude: [
/[\/\\](node_modules|build|docs|bin|storybook|tests|test)[\/\\]/,
],
use: {
loader: 'babel-loader',
options: {
@ -208,7 +210,7 @@ const getMainConfig = ( options = {} ) => {
rules: [
{
test: /\.(j|t)sx?$/,
exclude: /node_modules/,
exclude: [ /[\/\\](node_modules|build|docs|vendor)[\/\\]/ ],
use: {
loader: 'babel-loader',
options: {
@ -349,7 +351,7 @@ const getFrontConfig = ( options = {} ) => {
rules: [
{
test: /\.(j|t)sx?$/,
exclude: /node_modules/,
exclude: [ /[\/\\](node_modules|build|docs|vendor)[\/\\]/ ],
use: {
loader: 'babel-loader',
options: {
@ -471,7 +473,7 @@ const getPaymentsConfig = ( options = {} ) => {
rules: [
{
test: /\.(j|t)sx?$/,
exclude: /node_modules/,
exclude: [ /[\/\\](node_modules|build|docs|vendor)[\/\\]/ ],
use: {
loader: 'babel-loader',
options: {
@ -582,7 +584,7 @@ const getExtensionsConfig = ( options = {} ) => {
rules: [
{
test: /\.(j|t)sx?$/,
exclude: /node_modules/,
exclude: [ /[\/\\](node_modules|build|docs|vendor)[\/\\]/ ],
use: {
loader: 'babel-loader',
options: {
@ -693,7 +695,7 @@ const getSiteEditorConfig = ( options = {} ) => {
rules: [
{
test: /\.(j|t)sx?$/,
exclude: /node_modules/,
exclude: [ /[\/\\](node_modules|build|docs|vendor)[\/\\]/ ],
use: {
loader: 'babel-loader',
options: {
@ -856,6 +858,7 @@ const getStylingConfig = ( options = {} ) => {
rules: [
{
test: /\.(j|t)sx?$/,
exclude: [ /[\/\\](node_modules|build|docs|vendor)[\/\\]/ ],
use: {
loader: 'babel-loader',
options: {
@ -976,7 +979,7 @@ const getInteractivityAPIConfig = ( options = {} ) => {
rules: [
{
test: /\.(j|t)sx?$/,
exclude: /node_modules/,
exclude: [ /[\/\\](node_modules|build|docs|vendor)[\/\\]/ ],
use: [
{
loader: require.resolve( 'babel-loader' ),
@ -1062,7 +1065,7 @@ const getCartAndCheckoutFrontendConfig = ( options = {} ) => {
rules: [
{
test: /\.(j|t)sx?$/,
exclude: /node_modules/,
exclude: [ /[\/\\](node_modules|build|docs|vendor)[\/\\]/ ],
use: {
loader: 'babel-loader',
options: {

View File

@ -0,0 +1,4 @@
Significance: patch
Type: dev
Monorepo: tweak Webpack loaders paths filtering for better build perfromance.