Closed nextgenthemes closed 1 week ago
Hi, This issue has gone 30 days without any activity. This means it is time for a check-in to make sure it is still relevant. If you are still experiencing this issue with the latest versions, you can help the project by responding to confirm the problem and by providing any updated reproduction steps. Thanks for helping out.
yes
Hi, This issue has gone 30 days without any activity. This means it is time for a check-in to make sure it is still relevant. If you are still experiencing this issue with the latest versions, you can help the project by responding to confirm the problem and by providing any updated reproduction steps. Thanks for helping out.
yes
Also recieving this error. Any help or did you resolve this?
I'm not sure of the exact cause, but it seems that when the --experimental-modules
flag is enabled, this problem occurs because the defaultConfig
is an object, not an array.
Therefore, I overwrote the settings for each element of the array as shown below, and the error no longer appeared:
const WebpackNotifierPlugin = require( 'webpack-notifier' );
const defaultConfig = require( '@wordpress/scripts/config/webpack.config' );
const config = defaultConfig.map( ( config ) => {
return {
...config,
plugins: [ ...config.plugins, new WebpackNotifierPlugin( { onlyOnError: true } ) ],
};
});
module.exports = config;
I hope this helps.
Yes, @t-hamano is correct. Currently there need to be two configs to support ES Modules. That’s why it’s behind the experimental flag and subject to change in the future.
Description
Reduced
webpack.config.js
. Works perfectly fine without--experimental-modules
commandline:
Step-by-step reproduction instructions
Screenshots, screen recording, code snippet
No response
Environment info
@wordpress/scripts@27.6.0
node -v v21.7.2
npm -v 10.5.0
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