-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug] build storybook failed with library type:module #71
Comments
This seems like a classic esm vs commonjs issue but what version of storybook are you running? If those errors are from ts there are also rules you can add to typescript which allow you to import without the js extension. |
hey @dannyhw my storybook version is 6 in my project that works (import without the js extension) attached my
|
@YOEL311 are you able to make a minimal reproduction in a public repository? I've never really ran into this problem before so I'd have to look closer. Though its sounding like a configuration thing. You could also try some of the solutions here storybookjs/storybook#11587 |
@dannyhw |
@YOEL311 you don't need to use that same library, just setup a project with ESM and see if it has the same issue. |
@dannyhw Thanks But I can show it to you in a joint conversation |
@YOEL311 sorry I'm travelling and working right now so my free time is kinda limited. Normally I would but for now I can't really take a call. |
ok use it in the project this is the storyboard project https://github.com/YOEL311/storybookPublic Thanks to reproduce issue |
Ok thanks I will take a look soon |
I try to add the js extension as a manual https://github.com/YOEL311/componentsPublic/releases/tag/v0.0.35 but now I got another error
I also tried to change the type of library to CommonJS in the commit
|
That doesn't look like an issue with esm, its more likely that your componentsPublic isn't transpiled for web, you can add that package to be transpiled. |
having a little bit of trouble getting esm working for you but I'm looking into it |
@dannyhw You can see the fix in this commit
|
That's actually quite normal, metro will transpile everything whereas with webpack node modules are ignored in transpilation and must be explicity included. |
Describe the bug
I have written the library to be used in my company
the library works as well in my react-native app
it also works without any problem in the react-native storybook app,
but when I built an app for the storybook web app the build failed with this error
the library import with this Syntax
export * from './button';
or
import ButtonCore from './core';
but the web app needs
export * from './button.js';
or
import ButtonCore from './core.js';
how I can resolve this error without rewriting all library
The text was updated successfully, but these errors were encountered: