next.js: Next 12 & Storybook - build stuck

Run next info (available from version 12.0.8 and up)

Operating System: Platform: darwin Arch: arm64 Version: Darwin Kernel Version 20.6.0: Mon Aug 30 06:12:20 PDT 2021; root:xnu-7195.141.6~3/RELEASE_ARM64_T8101 Binaries: Node: 16.13.2 npm: 8.1.2 Yarn: 1.22.17 pnpm: N/A Relevant packages: next: 12 react: 17.0.2 react-dom: 17.0.2

What version of Next.js are you using?

12

What version of Node.js are you using?

16.13.2

What browser are you using?

Brave

What operating system are you using?

macOS

How are you deploying your application?

other

Describe the Bug

we have a storybook (“@storybook/react”: "^6.4.18) which export a node module installed in our next project. With NextJS 12, everything works fine in dev mode, but each time we try to yarn build after a few seconds the build is stuck at the stage “info - Creating an optimized production build …”. We have to kill the next build process.

if we downgrade to NextJS 11.1.4, everything is ok and the build complete.

trying next@canary do not work as next@12

Expected Behavior

the build should complete with Next v12.

To Reproduce

  • update Next from v11.1.4 to v12
  • use a custom node_module exported from Storybook
  • next build
  • the running build freeze after a few seconds

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 22 (10 by maintainers)

Most upvoted comments

I wonder if https://storybook.js.org/addons/storybook-addon-next would be a better solution, given it is the official recommendation. In any case, to keep it related to the original issue, we would still need a reproduction to verify if the problem is with Next.js or not.

@balazsorban44 yes, we’re using TypeScript. But the build do not stall at the type checks, but when it’s “info - Creating an optimized production build …”, the three dots animation freeze at any time.