modernweb-dev / web

Guides, tools and libraries for modern web development.
https://modern-web.dev
MIT License
2.21k stars 286 forks source link

[dev-server-storybook] build crashes, asks for a babel plugin #1855

Open jdvivar opened 2 years ago

jdvivar commented 2 years ago

Hi

I've got this error when doing a build-storybook (wds works perfectly when serving locally though):

Add @babel/plugin-syntax-import-assertions (https://git.io/JUbkv) to the 'plugins' section of your Babel config to enable parsing.

I'm not sure how to fix it since I think I only have control over Rollup plugins, as explained here https://modern-web.dev/docs/dev-server/plugins/storybook/#customizing-the-build

I've tried this without success on .storybook/main.js:

const { babel } = require('@rollup/plugin-babel');

module.exports = {
  rollupConfig(config) {
    config.plugins.push(babel({
      plugins: [
        [require.resolve('@babel/plugin-syntax-import-assertions')]
      ]
    }));
    return config;
  },
};

Any help or hint about how to proceed?

jdvivar commented 2 years ago

Maybe @LarsDenBakker :)