You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a project dedicated to Storybook configuration and tools.
Naturally, I want to dogfood the project.
Using project name reference work only if the project is built.
I want to reduce the friction by using import map:
** Disclaimer** This information might be inaccurate, due to it being generated automatically
This appears to be related to how Storybook handles ESM imports and import maps. To resolve: 1. Modify the builder config in .storybook/main.ts to explicitly enable import maps: ts export default { framework: '@storybook/react-vite', core: { builder: { name: '@storybook/builder-vite', options: { experimental: { importMap: true } } } } } 2. The import map needs to be configured in a separate importmap.json file rather than package.json: json { "imports": { "#hello/sb/main": "./src/main/index.ts", "#hello/sb/manager": "./src/manager/index.ts" } } 3. Reference this file in your Vite config: ts import { defineConfig } from 'vite' export default defineConfig({ optimizeDeps: { include: ['#hello/sb/main', '#hello/sb/manager'] } })
About Greptile
This response provides a starting point for your research, not a precise solution.
Help us improve! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.
Describe the bug
I have a project dedicated to Storybook configuration and tools.
Naturally, I want to dogfood the project.
Using project name reference work only if the project is built.
I want to reduce the friction by using import map:
But this doesn't work because my code is in ESM with
verbatimModuleSyntax
.i.e. with the ugly
.js
file extension:Storybook fails with:
Reproduction link
https://stackblitz.com/edit/github-kk2ewh2q?file=.storybook%2Fmain.ts
Reproduction steps
The
stackblitz
link has error on the#proj
import, but I think that's some different issue.System
Additional context
No response
The text was updated successfully, but these errors were encountered: