Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wp-scripts: Build fails when using pnpm with hoisting disabled. #67866

Closed
2 of 6 tasks
manzoorwanijk opened this issue Dec 12, 2024 · 4 comments · Fixed by #68201
Closed
2 of 6 tasks

wp-scripts: Build fails when using pnpm with hoisting disabled. #67866

manzoorwanijk opened this issue Dec 12, 2024 · 4 comments · Fixed by #68201
Labels
[Tool] WP Scripts /packages/scripts [Type] Bug An existing feature does not function as intended

Comments

@manzoorwanijk
Copy link
Member

manzoorwanijk commented Dec 12, 2024

Description

While reproducing #67864, I noticed that if I don't install @bable/runtime as a dependency, I see an error when using pnpm with hoisting disabled.

Error: Cannot find module '@babel/runtime/helpers/interopRequireDefault'

The fix the probably to have @bable/runtime as a dependency for the scripts package.

⚠ Click to expand the full error reported ⚠ > wp-scripts build

[webpack-cli] Failed to load '/node_modules/.pnpm/@wordpress+scripts@30.7.0_@playwright+test@1.49.1_@types+eslint@9.6.1_@types+node@22.10.2_@ty_wroepmchm5g4fgh3o3zlqgqj4a/node_modules/@wordpress/scripts/config/webpack.config.js' config
[webpack-cli] Error: Cannot find module '@babel/runtime/helpers/interopRequireDefault'
Require stack:

Step-by-step reproduction instructions

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

Please confirm which theme type you used for testing.

  • Block
  • Classic
  • Hybrid (e.g. classic with theme.json)
  • Not sure
@manzoorwanijk manzoorwanijk added the [Type] Bug An existing feature does not function as intended label Dec 12, 2024
@t-hamano t-hamano added the [Tool] WP Scripts /packages/scripts label Dec 12, 2024
@gziolo
Copy link
Member

gziolo commented Dec 20, 2024

@babel/runtime is listed as a dependency for @wordpress/babel-preset-default:

"@babel/runtime": "7.25.7",

which is listed as a dependency for @wordpress/scripts:

"@wordpress/babel-preset-default": "*",

I'm not sure what exactly happens when using pnpmwith hoisting disabled, but I would expect it has the package installed.

Is that issue specific to @wordpress/dataviews package with the build-wp version or a general problem?

@manzoorwanijk
Copy link
Member Author

I'm not sure what exactly happens when using pnpm with hoisting disabled, but I would expect it has the package installed.

It's something related to the import of rtlcss-webpack-plugin which interestingly defines @babel/runtime as a dependency

Is that issue specific to @wordpress/dataviews package with the build-wp version or a general problem?

No, it's a general issue.

@gziolo
Copy link
Member

gziolo commented Dec 20, 2024

I was checking rtlcss-webpack-plugin and it might not be actively maintained as there is PR ready for updating @babel/runtime dependency in their repository. We also have a related issue tracked already:

The plugin is so simple that we could consider forking it. In fact, we already use a fork ... 😅

@gziolo
Copy link
Member

gziolo commented Dec 20, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Tool] WP Scripts /packages/scripts [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants