-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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]: Unable to import 'rfc4648' #22542
Comments
Sounds like my recent question "Storybook fails with "Cannot read properties of undefined (reading 'base16')" for some components" on Stack Overflow, possibly related to |
Same issue here... :/ |
I haven't narrowed down what is happening exactly, but I have found that if I remove the "exports": {
".": {
"types": "./lib/src/index.d.ts",
"import": "./lib/index.mjs",
"require": "./lib/index.js"
},
"./package.json": "./package.json"
}, In the I am also having the problem with the angular-auth-oidc-client package, but I was able to reproduce it with just the rfc4648 package that it uses, so I didn't consider it to be an |
I found a rule in Storybooks webpack config that I can remove and the error doesn't happen. storybook/code/lib/builder-webpack5/src/preview/iframe-webpack.config.ts Lines 287 to 290 in 3aba9cf
I am not sure why that rule is there. At least for Angular, I assume all the necessary Typescript rules are already being added by it, so my current workaround is to remove that rule. This may break something that I just haven't noticed, yet, but my current workaround is to filter out the rule in // main.js
module.exports = {
...,
webpackFinal: config => {
config.module.rules = config.module.rules.filter(rule => !(rule.type === 'javascript/auto' && rule.test?.toString() === /\.m?js$/.toString()))
return config
}
} |
@ndelangen It looks like #18534 added storybook/code/lib/builder-webpack5/src/preview/iframe-webpack.config.ts Lines 287 to 296 in 3aba9cf
The comment on that commit references a Stackoverflow answer that says to add these two rules. Looking at the comment it references, the first rule seems to only be necessary for being able to use the second rule in some cases. It there a reason we need that first rule or would have a problem by removing it when building Angular? |
If angular wants something else, that's fine with me, but we should consult the @storybookjs/angular team. The rule could be removed by the angular framework. |
I'm actually not sure. According to my short research, the second rule should be just fine without the first rule 🤔 (the StackOverflow comment mentions as well)
|
After filter out the rules, the issue is gone. |
I have published rfc4648 v1.5.3, which should contain a fix for this issue. Upgrading the dependency may be all you need. |
Just updated my dependencies and the problem does appear to be fixed. |
Describe the bug
I have a dependency using the "rfc4648" package and none of my stories will work if I have that dependency imported anywhere. I am trying to figure out what about how Storybook is building the project causes that package to not work, but hoping someone more familiar with the build process can help find the problem faster.
The following is the error in the console, but I provided a Stackblitz repro with just one simple Component and Story that reproduces the issue.
To Reproduce
https://github.com/Marklb/sb-repro-22542
https://stackblitz.com/edit/github-qjqvmy-hdq5tc?file=src%2Fapp%2Fexample.component.ts,package.json
System
Additional context
No response
The text was updated successfully, but these errors were encountered: