tajo / ladle

🥄 Develop, test and document your React story components faster.
https://www.ladle.dev
MIT License
2.63k stars 93 forks source link

Adds option to disable default @vite/pugin-react injection #436

Closed Scott-Fischer closed 1 year ago

Scott-Fischer commented 1 year ago

This PR adds a new ladle config option to support cases where the user does not desire the automatic injection of @vite/pugin-react into their vite config.

A good example of this is to support fast-refresh functionality in preact projects (as documented in issue #435).

After this PR lands in main, I'd be happy to add a preact recipe to the docs in a followup PR. Closes #435

changeset-bot[bot] commented 1 year ago

🦋 Changeset detected

Latest commit: e7fc2e41e3f447d9974856e3fe7670481259d65d

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 13 packages | Name | Type | | ----------------- | ----- | | @ladle/react | Minor | | website | Minor | | example | Patch | | test-addons | Patch | | test-config | Patch | | test-config-ts | Patch | | test-css | Patch | | test-decorators | Patch | | test-flow | Patch | | test-playwright | Patch | | test-programmatic | Patch | | test-provider | Patch | | test-swc | Patch |

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

vercel[bot] commented 1 year ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
ladle ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 11, 2023 7:44pm
tajo commented 1 year ago

It would be great to add e2e/preact to

Also adding a page to https://ladle.dev/docs/ - recipes - Preact to describe how to setup Preact would be great.

I don't think there is any another reason why would anyone need to disable the default React plugin unless trying to use Preact so we should document & test the Preact setup.

jrson83 commented 1 year ago

@Scott-Fischer any news on this? Would be great if you add the requested changes.

Scott-Fischer commented 1 year ago

@jrson83 @justb3a Sorry for the delay on this. I got distracted with another project. I'm hoping to finish this PR at some point this week.

jrson83 commented 1 year ago

@tajo anything holding back merge? Would be great to have it soon.

tajo commented 1 year ago

@tajo anything holding back merge? Would be great to have it soon.

I don't think the implementation works right now? hasDisabledReactPlugin is not really being used

Scott-Fischer commented 1 year ago

@tajo I seem to have potentially royally borked up this PR by trying to pull in the upstream changes to my fork. Any idea why it's showing so many file changes in PR comparison but only a few in my fork? https://github.com/tajo/ladle/compare/main...Scott-Fischer:ladle:main

tajo commented 1 year ago

Have you rebased your main branch? Anyway, you can always close this and create a new PR