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

Can´t intialize msw on Sveltekit + Typescript #120

Closed
danielfromCL opened this issue Sep 13, 2023 · 1 comment
Closed

Can´t intialize msw on Sveltekit + Typescript #120

danielfromCL opened this issue Sep 13, 2023 · 1 comment

Comments

@danielfromCL
Copy link

danielfromCL commented Sep 13, 2023

I'm using Sveltekit with Typescript, and when setting up this addon, the following error is thrown when I import the initialize method and try to visualize a story:
missing name after . operator

I have this code for Preview.ts

import { initialize, mswLoader } from 'msw-storybook-addon';

// Initialize MSW
initialize();

const preview: Preview = {
  parameters: {
    actions: { argTypesRegex: '^on[A-Z].*' },
    controls: {
      matchers: {
        color: /(background|color)$/i,
        date: /Date$/
      }
    }
  },
  // Provide the MSW addon loader globally
  loaders: [mswLoader]
};

export default preview;

This error occurs even if I don't use the initialize method, since only importing the method is enough to make all my stories throw said error.
I'm using Storybook 7.4.1 and msw-storybook-addon 1.8.0.
I've tried debugging and searching through al the issues, though apparently no one has had this problem, so any help would be highly appreciated as I'm new to Storybook.
Thanks!

@danielfromCL
Copy link
Author

I'll leave this here in case anyone has the same problem:
The problem apparently was with the 'graphql' dependency version for msw (ref: mswjs/msw#1655), so the solution was overriding the graphql version to 16.6.0.

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

No branches or pull requests

1 participant