-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
Next.js: Fix module transpilation #31501
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
Next.js: Fix module transpilation #31501
Conversation
View your CI Pipeline Execution ↗ for commit 599144c.
☁️ Nx Cloud last updated this comment at |
Hi @valentinpalkovic 👋 Thanks for this PR, I didn't know how to fix it myself. This is very useful with libraries like nativewind, react-native-primitives etc. |
Here you go: 0.0.0-pr-31501-sha-8f7da28d (ready in like 20 minutes) Could you maybe provide a minimal reproduction so that I can also test it out? |
Package BenchmarksCommit: No significant changes detected, all good. 👏 |
@valentinpalkovic thank you so much, sure sure will do the reproduction repo as well. |
Hi @valentinpalkovic 👋 I'm the same guy but with my own personal github account and not with company account. thank you so much for this update, it fixed the issue with nextjs you can find the repo to test it out here: https://github.com/TheMichio/nativewind-nextjs-storybook I tried to setup the same setup in a monorepo setup, but there was some issue with but if you want that reproduction repo I will share it with you as well. 🙇 |
Hi @valentinpalkovic 👋 Can you please check the reproduction repo and if everything is ok merge this to next release? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
4 files reviewed, 1 comment
Edit PR Review Bot Settings | Greptile
import { getNodeModulesExcludeRegex } from '../utils'; | ||
|
||
export const configureBabelLoader = async ( | ||
baseConfig: any, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: Consider using a more specific type than 'any' for baseConfig
Hi @valentinpalkovic 👋 Is there anything else I can do to help with merging this to the next version? I'm really pending on this feature 🙇 |
Hi @TheMichio, Nothing pending. I've just forgotten about it. :) |
…-transpilation Next.js: Fix module transpilation (cherry picked from commit a0d1b3e)
Closes #22070
What I did
Added support for Next.js' module transpilation feature
Checklist for Contributors
Testing
The changes in this PR are covered in the following automated tests:
Manual testing
This section is mandatory for all contributions. If you believe no manual test is necessary, please state so explicitly. Thanks!
Documentation
MIGRATION.MD
Checklist for Maintainers
When this PR is ready for testing, make sure to add
ci:normal
,ci:merged
orci:daily
GH label to it to run a specific set of sandboxes. The particular set of sandboxes can be found incode/lib/cli-storybook/src/sandbox-templates.ts
Make sure this PR contains one of the labels below:
Available labels
bug
: Internal changes that fixes incorrect behavior.maintenance
: User-facing maintenance tasks.dependencies
: Upgrading (sometimes downgrading) dependencies.build
: Internal-facing build tooling & test updates. Will not show up in release changelog.cleanup
: Minor cleanup style change. Will not show up in release changelog.documentation
: Documentation only changes. Will not show up in release changelog.feature request
: Introducing a new feature.BREAKING CHANGE
: Changes that break compatibility in some way with current major version.other
: Changes that don't fit in the above categories.🦋 Canary release
This pull request has been released as version
0.0.0-pr-31501-sha-8f7da28d
. Try it out in a new sandbox by runningnpx [email protected] sandbox
or in an existing project withnpx [email protected] upgrade
.More information
0.0.0-pr-31501-sha-8f7da28d
valentin/fix-nextjs-module-transpilation
8f7da28d
1747902677
)To request a new release of this pull request, mention the
@storybookjs/core
team.core team members can create a new canary release here or locally with
gh workflow run --repo storybookjs/storybook canary-release-pr.yml --field pr=31501
Greptile Summary
Implements Next.js's
transpilePackages
configuration in Storybook to fix module transpilation issues, enabling proper handling of ES6 packages in node_modules.getNodeModulesExcludeRegex
utility incode/frameworks/nextjs/src/utils.ts
to generate dynamic exclude patternscode/frameworks/nextjs/src/babel/loader.ts
to usetranspilePackages
configcode/frameworks/nextjs/src/swc/loader.ts
to support package transpilationcode/frameworks/nextjs/src/preset.ts
to properly handle both Babel and SWC compilation