-
-
Notifications
You must be signed in to change notification settings - Fork 9.1k
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]: 'Dynamic require of "@storybook/global" is not supported' error when upgraded to v7.6.3 #25130
[Bug]: 'Dynamic require of "@storybook/global" is not supported' error when upgraded to v7.6.3 #25130
Comments
Running into similar but different error with same scenario of upgrading from 7.5.2 -> 7.6.3: Interestingly enough didn't see this in another repo we have that was on 7.0.x -> 7.6.3 so that's odd. Edit: using node 20/npm 10, react 18, w/ webpack 5 |
Hello, same issue here Cannot find module '@storybook/global'
webpackEmptyContext@http://localhost:1337/node_modules_storybook_addon-actions_dist_sync_recursive-libs_ui_src_components_Alert_Alert_s-9237db.bundle.js:10:10
../../lib/channels/dist/index.js@http://localhost:1337/vendors-node_modules_storybook_addon-actions_dist_index_js.bundle.js:34:21335
./node_modules/@storybook/addon-actions/dist/index.js/__commonJS/<@http://localhost:1337/vendors-node_modules_storybook_addon-actions_dist_index_js.bundle.js:19:727
./node_modules/@storybook/addon-actions/dist/index.js@http://localhost:1337/vendors-node_modules_storybook_addon-actions_dist_index_js.bundle.js:34:30716
options.factory@http://localhost:1337/runtime~main.iframe.bundle.js:669:31
__webpack_require__@http://localhost:1337/runtime~main.iframe.bundle.js:28:33
fn@http://localhost:1337/runtime~main.iframe.bundle.js:326:21
../libs/ui/src/components/Alert/Alert.stories.js@http://localhost:1337/node_modules_storybook_addon-actions_dist_sync_recursive-libs_ui_src_components_Alert_Alert_s-9237db.bundle.js:34:101
options.factory@http://localhost:1337/runtime~main.iframe.bundle.js:669:31
__webpack_require__@http://localhost:1337/runtime~main.iframe.bundle.js:28:33
fn@http://localhost:1337/runtime~main.iframe.bundle.js:326:21 Storybook Environment Info:
System:
OS: Linux
CPU:
Shell: 3.6.1 - /usr/bin/fish
Binaries:
Node: 18.18.2 - /tmp/xfs-af80f7bb/node
Yarn: 3.6.1 - /tmp/xfs-af80f7bb/yarn <----- active
npm: 9.8.1 - /run/user/1000/fnm_multishells/289349_1701443481879/bin/npm
Browsers:
Chrome: 121.0.6129.0
npmPackages:
@storybook/addon-essentials: ^7.6.3 => 7.6.3
@storybook/addon-links: ^7.6.3 => 7.6.3
@storybook/react: ^7.6.3 => 7.6.3
@storybook/react-webpack5: ^7.6.3 => 7.6.3
storybook: ^7.6.3 => 7.6.3
storybook-router: 0.2.9 => 0.2.9 |
Actually the issue seems to be with the |
I am getting the same error message when loading up storybook. I was able to pin it down to a 3rd party library that is pretty out of date. If I remove usage of storybook-react-router then storybook loads as expected. Looking at storybook-react-router, they have an old dependency on addon-actions.
Running So to help troubleshoot your own setup, try running Update: I also had to remove |
Pinning {
...
"pnpm": {
"overrides": {
"@storybook/addon-actions": "~7.5"
}
}
} |
Installing |
The only thing that seems to work for me is pinning the addons I use to the "resolutions": {
"@storybook/addon-actions": "7.5.3",
"@storybook/addon-links": "7.5.3"
}, export default {
addons: [
'@storybook/addon-links',
'@storybook/addon-actions',
'@etchteam/storybook-addon-status',
],
}; |
For me it's due to addon-console: |
@shilman I did some investigations, and it seems the webpack This is a problem. But it's very confusing. Here's what I've been able to gather:
De-noising the error:
That's where the error comes from (note also that webpack does not error in the terminal, but only in the browser) I'm tracing the breakage futher and I see webpack has outputted this code: var global$1 = __webpack_require__(/*! @storybook/global */ "@storybook/global");
__webpack_require__(/*! @storybook/core-events */ "@storybook/core-events");
var previewErrors = __webpack_require__(/*! @storybook/core-events/preview-errors */ "./node_modules/@storybook/core-events/dist/errors/preview-errors.js");
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf,
__hasOwnProp = Object.prototype.hasOwnProperty;
var __require = (x => true ? __webpack_require__("./node_modules/@storybook/addon-actions/dist sync recursive") : 0)(function (x) {
if (true) return __webpack_require__("./node_modules/@storybook/addon-actions/dist sync recursive").apply(this, arguments);
throw Error('Dynamic require of "' + x + '" is not supported');
}); It's this: That context is later used in addon-console > addon-actions' bundled code, and it's not able find it, because ...well... its an emptyContext! The strangest thing is, that there's even both an externalization for If we can figure out how and why this "./node_modules/@storybook/addon-actions/dist sync recursive" context is created/is empty we might get closer to a solution. Out of desperation, I tried a thing: So that's 1 path forwards, I guess? Why that makes it work, I haven't figured out really. |
To follow up, I tried bringing addon-console up to date with modern tooling, and it's do-able, but looking at the addon, a lot of it doesn't quite make sense.
I opened a PR adding ESM, and compiling with tsup |
Any updates on this? We are unable to update storybook to |
Heads up for anyone also using Chromatic, pinning |
I have an update: There's a canary version available. Could someone try upgrading this it, to see if it fixes the problem for them? 🙏 |
@ndelangen Tested on |
My issue is with stories that use |
Hi @soren121, I had the same issue:
|
Let me chime in and say that I dont use |
I think I've found the issue in my own project. Those of you with the I had |
We created another fix for this issue (#26145) and released a canary containing it which can be tested by running:
The canary is based on Storybook 8, but once the fix is confirmed and merged, we will patch it to Storybook 7.6 as well. @stevoland @adamdiestelkamp @DeepRed @soren121 Would you mind testing it out and letting us know? 🙏 |
For lazy dudes like me coming from Google |
Describe the bug
When we upgraded all our @storybook/ packages from
7.5.2
to7.6.3
and then ran a storybook project, we got this error:'Dynamic require of "@storybook/global" is not supported'
Nothing else has been changed on our side, thus am reporting it as a potential issue from your side.
To Reproduce
Purge package-lock and node_modules and update used sb packages to
7.6.3
then run a storybook in dev or build you should immediately get this error when you open the browser.System
Storybook Environment Info: System: OS: macOS 14.1.2 CPU: (8) x64 Intel(R) Core(TM) i7-1068NG7 CPU @ 2.30GHz Shell: 5.9 - /bin/zsh Binaries: Node: 18.12.1 - /usr/local/bin/node Yarn: 1.22.19 - /usr/local/bin/yarn npm: 8.19.2 - /usr/local/bin/npm <----- active pnpm: 8.10.2 - /usr/local/bin/pnpm Browsers: Chrome: 120.0.6099.62 Safari: 17.1.2 npmGlobalPackages: @storybook/react: 7.4.5 storybook: 7.5.2
Additional context
we are using react with vite builder for storybook
The text was updated successfully, but these errors were encountered: