#When using `define`: Identifier '__esbuild_register_import_meta_url__' has already been declared

4 messages · Page 1 of 1 (latest)

lucid tundra
#

main.cjs

module.exports = {
  stories: [
    '../stories/**/*.stories.@(js|jsx|ts|tsx|mdx)',
    '../stories/**/*.story.@(js|jsx|ts|tsx|mdx)'
  ],
  addons: ['@storybook/addon-essentials'],
  core: {
    builder: '@storybook/builder-vite',
    disableTelemetry: true
  },
  framework: {
    name: '@storybook/react-vite'
  },
  docs: {
    docsPage: 'automatic'
  },
  // https://github.com/Integrayshaun/storybook-mui-example +
  // https://storybook.js.org/docs/7.0/react/configure/typescript
  typescript: {
    check: false,
    checkOptions: {},
    reactDocgen: 'react-docgen-typescript',
    reactDocgenTypescriptOptions: {
      allowSyntheticDefaultImports: false, // speeds up storybook build time
      esModuleInterop: false, // speeds up storybook build time
      shouldExtractLiteralValuesFromEnum: true, // makes union prop types like variant and size appear as select controls
      shouldRemoveUndefinedFromOptional: true, // makes string and boolean types that can be undefined appear as inputs and switches
      propFilter: prop =>
        console.log(prop.parent) || prop.parent
          ? !/node_modules\/(?!@mui)/.test(prop.parent.fileName)
          : true
    }
  }
};

vite.config.js

export default defineConfig(({ command, mode, ssrBuild }) => {
  return {
    plugins: [react()],
    base: mode === 'development' ? '/' : '/storybook',
    define: {
      'process.env': {}
    }
  };
});
#

this is the issue but still seeing it despite the update :x