Skip to content

Scripts: regression - webpack config cannot be extended anymore #44309

@loxK

Description

@loxK

Description

Until this commit It was possible to extend the wordpress-scripts webpack config.

This change breaks it. I was using it to compile es6 files using WordPress libraries (eg. @wordpress/api-fetch). This way I am able to control the input and output directories and filenames. It will then give me a bundle and a PHP files with scripts dependencies.

Here is a simplified example that works with version 24.0.0 and not 24.1.0: https://github.com/loxK/wordpress-scripts-test

Step-by-step reproduction instructions

  1. create a webpack config
  2. extend it and export
  3. use it
  4. see the error:
» npm run build                               

> build
> webpack

[webpack-cli] Failed to load '/home/www/test/webpack.config.js' config
[webpack-cli] TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined
    at new NodeError (node:internal/errors:387:5)
    at validateString (node:internal/validators:121:11)
    at Object.join (node:path:1172:7)
    at fromProjectRoot (/home/www/test/node_modules/@wordpress/scripts/utils/file.js:13:7)
    at hasProjectFile (/home/www/test/node_modules/@wordpress/scripts/utils/file.js:16:14)
    at getRenderPropPaths (/home/www/test/node_modules/@wordpress/scripts/utils/config.js:312:9)
    at Object.<anonymous> (/home/www/test/node_modules/@wordpress/scripts/config/webpack.config.js:41:21)
    at Module._compile (node:internal/modules/cjs/loader:1126:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1180:10)
    at Module.load (node:internal/modules/cjs/loader:1004:32) {
  code: 'ERR_INVALID_ARG_TYPE'
}

Screenshots, screen recording, code snippet

No response

Environment info

No response

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions