-
Notifications
You must be signed in to change notification settings - Fork 32
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
Add vite support #72
Add vite support #72
Conversation
Socket Security Pull Request Report👍 No new dependency issues detected in pull request Pull request report summary
Bot CommandsTo ignore an alert, reply with a comment starting with Powered by socket.dev |
@j3rem1e do you have any thoughts about this PR? I'm curious if you can think of any other ways that we can avoid using peer dependencies. There's some related discussion going on in storybookjs/storybook#19385, because I think this is an issue that will come up for other addons as well. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me, I think this is the correct way forward!
I changed the base branch to next
which caused a few conflicts though. I assumed this only works with the new Vite builder structure in 7.0, but I might be wrong?
@IanVS do you want to take a look at the merge conflicts, or instead target this back to 6.5? To me it looks like the conflicts are mostly about the upgrade to 7.0. |
# Conflicts: # .babelrc.js # package.json # src/preset/index.js # yarn.lock
"svelte": "^3.50.0", | ||
"svelte-jester": "^2.3.2", | ||
"svelte-loader": "^3.1.2", | ||
"typescript": "^3.9.7" | ||
"typescript": "^3.9.7", | ||
"vite": "^3.1.4" | ||
}, | ||
"peerDependencies": { | ||
"@storybook/svelte": ">=6.4.20", | ||
"@storybook/theming": ">=6.4.20", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this correct? Shouldn't these be 7.0?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right. Fixing in another PR
Thanks for the nudge @JReinhold, I think this is ready for re-review. I didn't have a chance to test it all out again. |
@JReinhold @j3rem1e either of you care to give this a last lookover? Should we try merging and getting things ready on the builder-vite side before the upcoming 7.0 beta release? |
🚀 PR was released in |
Closes #64
This adds the vite plugin from https://github.com/storybookjs/storybook/blob/next/code/frameworks/svelte-vite/src/plugins/csf-plugin.ts into this repo, and sets up a
viteFinal
to load it on vite storybook projects. There are a few things I'd like to call out here:target
for@babel/preset-env
, it was trying to add regeneratorRuntime into the built code, which failed because we're not adding it as a polyfill. I'm imagining that this PR, if merged, would be for use with storybook 7.0+, which supports Chrome 100+ and Node 14+, so those are the targets I added. This means it's probably a breaking change for this package, so I wanted to call that out explicitly.@sveltejs/vite-plugin-svelte
should be as well in a svelte vite project, but I added a little safety check around that one.I tested this by creating an example svelte project, modifying the vite builder to not inject the plugin and copying its
dist
over to the example, and building this addon and copying it'sdist
over as well. It worked correctly, but it might be nice to consider some tests or example project in this addon, for testing, as well. I didn't undertake that here, but can if desired.📦 Published PR as canary version:
2.0.11--canary.72.ae738ba.0
✨ Test out this PR locally via:
npm install @storybook/addon-svelte-csf@2.0.11--canary.72.ae738ba.0 # or yarn add @storybook/addon-svelte-csf@2.0.11--canary.72.ae738ba.0
Version
Published prerelease version:
v3.0.0-next.1
Changelog
💥 Breaking Change
🐛 Bug Fix
Authors: 2