storybook: [Bug]: Clean Vite + Svelte Install with Storybook leads to `ReferenceError: process is not defined`
Describe the bug
Hey all,
Just setting up a new storybook project, and ran it as documented in https://storybook.js.org/blog/storybook-for-vite/. Running storybook then triggers the client error:
ReferenceError: process is not defined (in memoizerific.js:4:31)
Digging a bit deeper, its specifically referring toprocess.env.FORCE_SIMILAR_INSTEAD_OF_MAP.
To Reproduce
- Run
pnpm create vite@latest, and when prompted:
- provide a project name
- select
Svelte - select
Typescript
cd into-your-projectpnpm install- Run
pnpx sb init --builder @storybook/builder-vite - Open [localhost](http://localhost:6006/) in your browser
- See Error:
process not defined - Check console.
System
System:
OS: macOS 13.0.1
CPU: (8) arm64 Apple M2
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 20.2.0 - /opt/homebrew/bin/node
npm: 9.6.6 - /opt/homebrew/bin/npm
pnpm: 8.6.1 - /opt/homebrew/bin/pnpm <----- active
Browsers:
Chrome: 119.0.6045.199
Safari: 16.1
npmPackages:
@storybook/addon-essentials: ^7.6.4 => 7.6.4
@storybook/addon-interactions: ^7.6.4 => 7.6.4
@storybook/addon-links: ^7.6.4 => 7.6.4
@storybook/blocks: ^7.6.4 => 7.6.4
@storybook/svelte: ^7.6.4 => 7.6.4
@storybook/svelte-vite: ^7.6.4 => 7.6.4
@storybook/test: ^7.6.4 => 7.6.4
storybook: ^7.6.4 => 7.6.4
Additional context
No response
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 15 (8 by maintainers)
I found that the main problem is with Vite
^5.0.0. Had to do a pretty bad workaround to make it work and I don’t really know how it will impact my project.the workaround is going to the
vite.config.jsfile and then addingdefine: { "process.env" : {} }, and the file will look like this:This looks pretty bad for me, but made it work.