Modyfi / vite-plugin-yaml

Transform a YAML file to a JS object
75 stars 15 forks source link

Unable to make it work with Storybook #16

Open trajano opened 1 year ago

trajano commented 1 year ago

When running with npm run build-storybook I get

vite v4.1.4 building for production... ✓ 421 modules transformed. [vite:build-import-analysis] Parse error @:1:43

But npm run build works correctly. Not really sure which part is causing the issue though.

alicenstar commented 8 months ago

I'm having a similar issue with vite 5, Storybook 7, and the latest version of this library (1.1.0). Building Storybook and running Storybook work fine, but when I go to look at my component that uses info from a .yml file, I get Error: Cannot read properties of undefined (reading 'titleTooltip'), where titleTooltip is being accessed as content.instanceDetailsInsights.titleTooltip, and content is a content.yml file that we are importing into the project that has our copy in it.

Here is where we're configuring the plugin in Storybook:

viteFinal: async config => {
  return mergeConfig(config, {
    resolve: {
      alias: {
        "@": path.resolve(path.dirname(__dirname), "src")
      }
    },
    plugins: [ViteSvgr({ include: '**/*.svg' }), ViteYaml()]
  });
},