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

[Bug]: Storybook couldn't evaluate your .storybook/main.ts file #30115

Closed
valentinpalkovic opened this issue Dec 20, 2024 · 5 comments
Closed

Comments

@valentinpalkovic
Copy link
Contributor

valentinpalkovic commented Dec 20, 2024

Describe the bug

Error message:

SB_CORE-SERVER_0007 (MainFileEvaluationError): Storybook couldn't evaluate your .storybook/main.ts file.
             Original error:
             Error: Transform failed with 1 error:
             (define name):1:0: ERROR: Expected identifier but found "import"

esbuild released a new version recently, containing a bug, affecting all Vite-based Storybooks.

Workaround

Pin the version of esbuild to the latest known working version, 0.24.0 (npm, pnpm):

// package.json
{
  "overrides": {
    "esbuild": "0.24.0"
  }
}

Use resolutions field in yarn projects:

// package.json
{
  "resolutions": {
    "esbuild": "0.24.0"
  }
}
@valentinpalkovic
Copy link
Contributor Author

Related esbuild bug: evanw/esbuild#4010
fix: evanw/esbuild#4013

jamesscottbrown added a commit to Greater-London-Authority/ldn-viz-tools that referenced this issue Dec 20, 2024
ChrisKnightLDN pushed a commit to Greater-London-Authority/ldn-viz-tools that referenced this issue Dec 20, 2024
* remove obsolete MapApp component

* fix storybook build

See storybookjs/storybook#30115

* fix storybook

* fix storybook

* fix storybook

* fix storybook

* update install steps in other workflows

* lint
@yannbf
Copy link
Member

yannbf commented Dec 20, 2024

This issue has been (esbuild downgraded) fixed in 8.5.0-beta.4 and will be fixed in 8.4.8, follow the release PR here: #29834

@yannbf
Copy link
Member

yannbf commented Dec 20, 2024

Update, the maintainer of esbuild made a fix and will release a new version soon, so all you'll have to do is update your yarn lock once that happens.

@jmuzina
Copy link

jmuzina commented Dec 20, 2024

Esbuild 0.24.2 has released and seems to have fixed this issue for me - update your lockfiles and you should be fine :)

@BretPehrsonWTW
Copy link

BretPehrsonWTW commented Dec 20, 2024

Confirmed that updating Esbuild from 0.24.1 to 0.24.2 fixed it for me.

@yannbf yannbf closed this as completed Dec 20, 2024
sergei-maertens added a commit to open-formulieren/open-forms-sdk that referenced this issue Dec 21, 2024
Released a couple of weeks ago :)

This currently requires us to force storybook vite builder to
resolve esbuild to 0.24.0, despite vite 6.0.5 pinning this
dependency. See storybookjs/storybook#30115
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

4 participants