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

Module parse failed: Unexpected token error when using next/link in storybook #18585

Closed
jeremytenjo opened this issue Jun 28, 2022 · 2 comments
Closed

Comments

@jeremytenjo
Copy link

jeremytenjo commented Jun 28, 2022

ERROR in ./node_modules/next/dist/shared/lib/router/router.js 37:8
Module parse failed: Unexpected token (37:8)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
| class Router {
|     // Server Data Cache
>     sdc = {};
|     isFirstPopStateEvent = true;
|     _key = createKey();
 @ ./node_modules/next/dist/client/link.js 7:14-52
 @ ./node_modules/next/link.js
 @ ./src/lib/utils/prismic/PrismicProvider/PrismicProvider.tsx
 @ ./src/lib/components/Prismic/Prismic.tsx
 @ ./devtools/storybook/preview.jsx
 @ ./storybook-config-entry.js
 @ multi ./node_modules/@storybook/core-client/dist/esm/globals/polyfills.js ./node_modules/@storybook/core-client/dist/esm/globals/globals.js (webpack)-hot-middleware/client.js?reload=true&quiet=false&noInfo=true ./storybook-config-entry.js

Expected Behavior

Run storybook without errors

To Reproduce

  1. Clone https://github.com/jeremytenjo/starter-website
  2. Install Dependencies (npm i)
  3. Run npm run storybook:dev
  4. Open http://localhost:6006
Environment Info:

  System:
    OS: macOS 12.4
    CPU: (8) arm64 Apple M1
  Binaries:
    Node: 16.15.0 - ~/.nvm/versions/node/v16.15.0/bin/node
    npm: 8.5.5 - ~/.nvm/versions/node/v16.15.0/bin/npm
  Browsers:
    Chrome: 103.0.5060.53
    Firefox: 95.0.2
    Safari: 15.5
  npmPackages:
    @storybook/addon-actions: ^6.5.9 => 6.5.9 
    @storybook/addon-essentials: ^6.5.9 => 6.5.9 
    @storybook/addon-interactions: ^6.5.9 => 6.5.9 
    @storybook/addon-links: ^6.5.9 => 6.5.9 
    @storybook/builder-vite: ^0.1.36 => 0.1.36 
    @storybook/react: ^6.5.9 => 6.5.9 
    @storybook/testing-library: ^0.0.13 => 0.0.13 
     next: 12.1.7-canary.51
@jeremytenjo
Copy link
Author

Nextjs issue vercel/next.js#38106

@jeremytenjo
Copy link
Author

Fixed in "next": "12.2.1-canary.1" - npm i next@canary

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant