web icon indicating copy to clipboard operation
web copied to clipboard

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

Open jdvivar opened this issue 3 years ago • 1 comments

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 avatar Jan 18 '22 22:01 jdvivar

Maybe @LarsDenBakker :)

jdvivar avatar Jan 19 '22 08:01 jdvivar