@wordpress/scripts: code compiled with npm start
works, and with npm run build
does not, when doing an import by relative path from a different package
#23540
Labels
[Tool] WP Scripts
/packages/scripts
[Type] Help Request
Help with setup, implementation, or "How do I?" questions.
Describe the bug
I have a plugin with multiple blocks (under folder
blocks/
) which access shared components. These shared components are located under a different folder within the same plugin (under folderpackages/
):Every block and package has its own
package.json
file.The blocks import the shared components through a relative path:
This code worked well with
@wordpress/scripts
version 8.1.0.However, after upgrading to version 10.0.0, it works when running
npm start
but not withnpm run build
.There are no compilation errors, but when executing the code in the browser (when creating a new post on Gutenberg), the screen is all white, and in the console I get this error:
When clicking there:
To reproduce
Steps to reproduce the behavior:
@wordpress/compose
) but through the relative path within the project (eg:import { compose } from '../../packages/compose/src';
npm run build
Expected behavior
I assume the relative path import across packages is not supported anymore, but this is not mentioned in the CHANGELOG, hence it's a guess.
If it is still supported, then code should work after running
npm run build
If not supported anymore, then running
npm start
andnpm run build
should both fail (currently,npm start
works well) and, ideally, the CHANGELOG should mention the steps needed to migrate the codeEditor version (please complete the following information):
@wordpress/scripts
versions 10.0.0, 11.0.0 and 12.0.0The text was updated successfully, but these errors were encountered: