-
Notifications
You must be signed in to change notification settings - Fork 106
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] Failed to resolve import "global" with yarn PNP #371
Comments
Hi, without a reproduction it's hard to say exactly what is happening. But vite does not polyfill node <script>
window.global = window;
</script> |
According to the stack-trace its the '/virtual:/@storybook/builder-vite/setup-addons.js' file that is importing 'global'. Polyfilling it myself, by adding the HTML file with the script, sadly didn't work. /Edit: builder-vite/codegen-set-addon-channel.ts contains the code. |
Note: Everything works fine when using the node-modules nodeLinker. It breaks only when using yarn P'n'P. |
Thanks, if you can provide a minimal reproduction, we can do our best to look into it. |
What version of
vite
are you using?2.9.8
System info and storybook versions
System:
OS: Windows 10 10.0.22000
CPU: (24) x64 AMD Ryzen 9 3900X 12-Core Processor
Binaries:
Node: 16.13.1 - C:\Program Files\nodejs\node.EXE
Yarn: 3.2.0 - ~\AppData\Roaming\npm\yarn.CMD
npm: 8.6.0 - C:\Program Files\nodejs\npm.CMD
Browsers:
Edge: Spartan (44.22000.120.0), Chromium (101.0.1210.32)
Describe the Bug
When using storybook and this build with Yarn P'n'P 'global' cannot be found.
Stack trace:
[vite] Internal server error: Failed to resolve import "global" from "..\..\..\..\virtual:\@storybook\builder-vite\setup-addons.js". Does the file exist? Plugin: vite:import-analysis File: /virtual:/@storybook/builder-vite/setup-addons.js 1 | import global from 'global'; | ^ 2 | import createPostMessageChannel from '@storybook/channel-postmessage'; 3 | import createWebSocketChannel from '@storybook/channel-websocket';
Link to Minimal Reproducible Example
Repro
Participation
The text was updated successfully, but these errors were encountered: