-
-
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
Fix dotenv resolution #16067
Comments
w00t!! I just released https://github.com/storybookjs/storybook/releases/tag/v6.4.0-alpha.41 containing PR #16105 that references this issue. Upgrade today to the
Closing this issue. Please re-open if you think there's still more to do. |
FWIW, updated to latest beta with latest Next and my Storybook won't build! edit; The build error seems to be with something about my custom webpack configuration; however, if I remove all webpack customization I'm still seeing |
@kylemh haven't had a chance to check out your storybook but i just created a fresh next app and |
@shilman I think this PR broke the case when
which becomes
which is invalid syntax. Also I'm not sure about how values are double stringified, but that's another issue. |
I've given this another go and just want to outline my steps:
Dev server seems to build, but the runtime has an error saying that "process is undefined" (among other errors) For added context, I don't have - and have never had - a |
@kylemh does it change anything if instead of using yarn resolutions, you install One idea, can you do:
And see if there are any old versions lying around? |
Nothing. I redid the work in a smaller PR, if it helps: OperationCode/front-end#1507 |
I had same issue with process deps. For me just mocking with DefinePlugin was not working. In my case I needed to use:
and
|
^ works for me too! @shilman
|
@kylemh do you think this should be included in the default config? |
If it doesn't hurt anything! I know this is all complex tooling though... I have no idea this negatively affects other setups! |
TL;DR I'd do it. Webpack 4 already included a So in theory, storybook's default webpack config can/should provide all shims and polyfills that were enabled in Webpack 4 builder. Tobias was kinda stubborn in his stance so he completely omitted the knowledge of how to re-polyfill them in webpack 5 migration guide here. But if you dig deep enough, you can find this, which is the node polyfills activated automatically in Webpack 4 when Obviously, Tobias' decision actually made sense. People tried using node.js specific libraries in the browser and webpack auto-mocked their dependencies and users were confused about where the bug is: in webpack or in the node.js specific library ? |
A valid question is, if we use a custom webpack config for our storybook builds, can we somehow remove node.js specific shims such as |
Great Caesar's ghost!! I just released https://github.com/storybookjs/storybook/releases/tag/v6.4.0-rc.4 containing PR #16725 that references this issue. Upgrade today to the
Closing this issue. Please re-open if you think there's still more to do. |
@shilman is it possible that this issue was reintroduced with v6.4.10? I am getting the process is not defined error on 6.4.10 when I was not getting it on 6.4.9. This is a chunk I have had with each SB version to attempt to resolve this issue. It worked before but no longer works: webpackFinal: (config) => {
config.plugins = [
...config.plugins,
new webpack.ProvidePlugin({
process: 'process/browser',
}),
];
return config;
} Edit: I just noticed that this was added to the default config so this chunk seems to have been redundant, but still the error in the browser seems to persist. |
@tylerjlawson do you have a reproduction i can look at? |
@shilman Here is a reproduction: https://github.com/tylerjlawson/sb-issue-repro I assumed the issue was simpler than it is, but the issue I am having seems to occur specifically when the Edit/Correction: I made a second commit to further simplify the reproduction, but the issue occurs whenever |
Zoinks!! I just released https://github.com/storybookjs/storybook/releases/tag/v6.5.0-alpha.15 containing PR #17213 that references this issue. Upgrade today to the
Closing this issue. Please re-open if you think there's still more to do. |
Good golly!! I just released https://github.com/storybookjs/storybook/releases/tag/v6.4.13 containing PR #17213 that references this issue. Upgrade today to the
|
Egad!! I just recently started getting this error in my production builds as well (running v6.5.9):
|
Ah, found out this was my own dang fault. In a previous commit in my project I had refactored calls like const config = {
whatever: process.env.SOMETHING,
} into import { SOMETHING } = process.env;
const config {
whatever: SOMETHING,
} Reverting that fixed this error for me. Thanks for coming to my TED talk. |
There's a bug in a new NextJS project where
assert
tries to accessprocess.env
and fails due to #15925Proposed fix:
STORYBOOK_x
process.env
as well for compatibility with NextJSWorkaround: create an empty
.env
file to get NextJS unstuckThe text was updated successfully, but these errors were encountered: