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] Newly initialized Preact repo - failing with pragma and pragmaFrag cannot be set when runtime is automatic. #451

Open
1 task
nixnao opened this issue Jul 19, 2022 · 3 comments
Labels
bug Something isn't working

Comments

@nixnao
Copy link

nixnao commented Jul 19, 2022

What version of vite are you using?

3.0.0

System info and storybook versions

Environment Info:

System:
OS: Windows 10 10.0.19044
CPU: (4) x64 Intel(R) Xeon(R) Platinum 8272CL CPU @ 2.60GHz
Binaries:
Node: 14.19.0 - C:\Program Files\nodejs\node.EXE
npm: 6.14.16 - C:\Program Files\nodejs\npm.CMD
Browsers:
Edge: Spartan (44.19041.1266.0), Chromium (103.0.1264.62)
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.2.0 => 0.2.0
@storybook/preact: ^6.5.9 => 6.5.9
@storybook/testing-library: 0.0.13 => 0.0.13

Describe the Bug

After initializing a new Preact Vite + Storybook repo and only making a change to remove "type: module" from package.json, all component stories fail to load with the error message:

`[vite] Internal server error: {localPath}\vite-preact-ts-pragma-error\src\stories\Button.stories.jsx: pragma and pragmaFrag cannot be set when runtime is automatic.

1 |
| ^
2 | /* eslint-disable */
3 | // @ts-nocheck
4 | // @ts-ignore
Plugin: vite:react-babel
File: {localPath}/vite-preact-ts-pragma-error/src/stories/Button.stories.jsx`

Steps to reproduce:

  1. npm create vite@latest (notable selections: preact, preact-ts)
  2. npx sb@next init
  3. Remove '"type": "module"' from package.json (or rename main.js to main.cjs) to properly compile.
  4. npm run storybook

Link to Minimal Reproducible Example

https://github.com/nixnao/PreactSBVitePragmaError

Participation

  • I am willing to submit a pull request for this issue.
@nixnao nixnao added the bug Something isn't working label Jul 19, 2022
@IanVS
Copy link
Member

IanVS commented Jul 21, 2022

@joshwooding we may need to rethink always adding the vite react plugin for MDX support, as seen here, it conflicts with preact.

@wmonecke
Copy link

wmonecke commented Mar 2, 2023

Any workarounds? This is still an issue since I just started a new preact project.

@IanVS
Copy link
Member

IanVS commented Mar 3, 2023

@wmonecke have you tried Storybook 7, by chance? I think that could solve your issue. You can start fresh with npx sb@next init or upgrade the existing project you started by using npx sb@next upgrade --prerelease.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants