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

Handle new versions of vite-plugin-svelte #382

Merged
merged 2 commits into from
May 18, 2022
Merged

Handle new versions of vite-plugin-svelte #382

merged 2 commits into from
May 18, 2022

Conversation

IanVS
Copy link
Member

@IanVS IanVS commented May 18, 2022

Fixes #381

There have been two changes in @sveltejs/vite-plugin-svelte that cause problems for us, which this PR addresses:

To test, you can revert the changes I've made in vite-config.ts, and you'll see that the svelte example breaks (I updated the svelte plugin in it). With the changes, it builds successfully.

This also enables the use of the new experimental inspection plugin.

image

To enable this feature, be sure you have @sveltejs/vite-plugin-svelte version 1.0.0-next.43 or higher, then add the following to your svelteOptions in .storybook/main.js:

module.exports = {
  // ... rest of config
  framework: '@storybook/svelte',
  svelteOptions: {
    preprocess: preprocess(),
    experimental: { inspector: true }, // <-- this line
  },
};

Then, when the storybook opens, focus a story iframe and press cmd+shift (mac) or ctrl+shift (windows) to activate.

@IanVS IanVS requested a review from joshwooding May 18, 2022 15:56
@IanVS IanVS merged commit babbc41 into main May 18, 2022
@IanVS IanVS deleted the svelte-plugin-fixes branch May 18, 2022 17:53
@benmccann benmccann mentioned this pull request Jul 6, 2022
IanVS pushed a commit that referenced this pull request Jul 8, 2022
Partially reverts #382

The reason given there was that:
> which may not be what storybook users want / expect, since their production config may be different from the storybook config (same reason we don't automatically merge vite.config.js)

However, I think that users would expect their `svelte.config.js` to be taken into account. E.g. right now the user's preprocessing configuration is ignored. The user can still pass custom `svelteOptions` in `.storybook/main.cjs` if they need to override their normal options for some reason (although I can't think of a reason off the top of my head why this would be necessary)

You can see a number of people complaining preprocessing doesn't work here: storybookjs/addon-svelte-csf#4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] @sveltejs/vite-plugin-svelte version 1.0.0-next.42+ breaks vite-builder
2 participants