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

NextJS: Add @babel/core as a dependency #22450

Merged
merged 8 commits into from
Jul 26, 2023

Conversation

valentinpalkovic
Copy link
Contributor

@valentinpalkovic valentinpalkovic commented May 8, 2023

Closes (Discord Support Ticket: https://discord.com/channels/486522875931656193/1102628762161512459)

What I did

@babel/core is not installed per default in Next.js anymore, because Next.js might not use webpack + babel, but turbopack and swc instead. Storybook though still relies on @babel/core for several transformations.

How to test

  1. Init a Yarn 3 PnP project
  2. Install Next.js
  3. sb init

Checklist

  • Make sure your changes are tested (stories and/or unit, integration, or end-to-end tests)
  • Make sure to add/update documentation regarding your changes
  • If you are deprecating/removing a feature, make sure to update
    MIGRATION.MD

Maintainers

  • If this PR should be tested against many or all sandboxes,
    make sure to add the ci:merged or ci:daily GH label to it.
  • Make sure this PR contains one of the labels below.

["cleanup", "BREAKING CHANGE", "feature request", "bug", "documentation", "maintenance", "dependencies", "other"]

@valentinpalkovic valentinpalkovic self-assigned this May 8, 2023
@valentinpalkovic valentinpalkovic force-pushed the valentin/nextjs-fix-yarn-pnp-issue branch from 8cb40a4 to f9d75f3 Compare May 8, 2023 12:45
@yannbf
Copy link
Member

yannbf commented May 11, 2023

Overall this looks good, but there's a failure in CI:

src/font/babel/index.ts(57,70): error TS2345: Argument of type 'typeof import("/tmp/storybook/code/node_modules/@babel/types/lib/index")' is not assignable to parameter of type 'typeof import("/tmp/storybook/code/frameworks/nextjs/node_modules/@babel/types/lib/index")'.
  Types of property 'BLOCK_SCOPED_SYMBOL' are incompatible.
    Type 'typeof babel.types.BLOCK_SCOPED_SYMBOL' is not assignable to type 'typeof BLOCK_SCOPED_SYMBOL'.
src/font/babel/index.ts(59,55): error TS2345: Argument of type 'typeof import("/tmp/storybook/code/node_modules/@babel/types/lib/index")' is not assignable to parameter of type 'typeof import("/tmp/storybook/code/frameworks/nextjs/node_modules/@babel/types/lib/index")'.
src/font/babel/index.ts(60,49): error TS2345: Argument of type 'typeof import("/tmp/storybook/code/node_modules/@babel/types/lib/index")' is not assignable to parameter of type 'typeof import("/tmp/storybook/code/frameworks/nextjs/node_modules/@babel/types/lib/index")'.
src/font/babel/index.ts(74,59): error TS2345: Argument of type 'typeof import("/tmp/storybook/code/node_modules/@babel/types/lib/index")' is not assignable to parameter of type 'typeof import("/tmp/storybook/code/frameworks/nextjs/node_modules/@babel/types/lib/index")'.
src/font/babel/index.ts(78,55): error TS2345: Argument of type 'typeof import("/tmp/storybook/code/node_modules/@babel/types/lib/index")' is not assignable to parameter of type 'typeof import("/tmp/storybook/code/frameworks/nextjs/node_modules/@babel/types/lib/index")'.
src/font/babel/index.ts(79,49): error TS2345: Argument of type 'typeof import("/tmp/storybook/code/node_modules/@babel/types/lib/index")' is not assignable to parameter of type 'typeof import("/tmp/storybook/code/frameworks/nextjs/node_modules/@babel/types/lib/index")'.

@valentinpalkovic valentinpalkovic force-pushed the valentin/nextjs-fix-yarn-pnp-issue branch from 793f13a to 34f43ac Compare May 11, 2023 09:21
@babel/core is not installed per default in Next.js anymore, because Next.js might not use webpack + babel, but turbopack and swc instead. Storybook though still relies on @babel/core for several transformations.
@valentinpalkovic valentinpalkovic force-pushed the valentin/nextjs-fix-yarn-pnp-issue branch from 34f43ac to dc2294d Compare June 19, 2023 12:32
@valentinpalkovic valentinpalkovic changed the title Add @babel/core as a dependency in Nextjs framework Next.js: Add @babel/core as a dependency Jun 19, 2023
@valentinpalkovic
Copy link
Contributor Author

@yannbf Can you take another look?

@valentinpalkovic valentinpalkovic added the ci:daily Run the CI jobs that normally run in the daily job. label Jun 19, 2023
@valentinpalkovic valentinpalkovic added the patch:yes Bugfix & documentation PR that need to be picked to main branch label Jul 21, 2023
@ndelangen ndelangen self-assigned this Jul 25, 2023
@ndelangen ndelangen requested a review from cdedreuille as a code owner July 25, 2023 13:14
@ndelangen ndelangen changed the title Next.js: Add @babel/core as a dependency Next.js: Add @babel/core as a dependency Jul 25, 2023
@ndelangen ndelangen merged commit 7f56548 into next Jul 26, 2023
@ndelangen ndelangen deleted the valentin/nextjs-fix-yarn-pnp-issue branch July 26, 2023 11:32
@ndelangen ndelangen changed the title Next.js: Add @babel/core as a dependency NextJS: Add @babel/core as a dependency Jul 26, 2023
This was referenced Jul 26, 2023
@github-actions github-actions bot mentioned this pull request Aug 3, 2023
32 tasks
@kasperpeulen kasperpeulen removed the patch:yes Bugfix & documentation PR that need to be picked to main branch label Aug 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug ci:daily Run the CI jobs that normally run in the daily job. nextjs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants