Skip to content
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

Core: Fix auto-title in webpack5 #16913

Merged
merged 1 commit into from
Dec 6, 2021
Merged

Conversation

shilman
Copy link
Member

@shilman shilman commented Dec 6, 2021

Issue: #16891 #16903

What I did

Webpack5 no longer includes path polyfills by default, so we need to add it by hand.

self-merging @tmeasday

How to test

I did sb link the repro from #16891 and it failed before the change & worked after

@nx-cloud
Copy link

nx-cloud bot commented Dec 6, 2021

Nx Cloud Report

CI ran the following commands for commit 8ddd297. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this branch

Status Command
#000000 nx run-many --target=prepare --all --parallel --max-parallel=15

Sent with 💌 from NxCloud.

@nx-cloud
Copy link

nx-cloud bot commented Dec 6, 2021

Nx Cloud Report

We didn't find any information for the current pull request with the commit 8ddd297.
You might need to set the 'NX_BRANCH' environment variable in your CI pipeline.

Check the Nx Cloud Github Integration documentation for more information.


Sent with 💌 from NxCloud.

@shilman shilman added the patch:yes Bugfix & documentation PR that need to be picked to main branch label Dec 6, 2021
@shilman shilman merged commit 0dc5d9a into next Dec 6, 2021
@shilman shilman deleted the 16891-fix-autotitle-webpack5 branch December 6, 2021 01:37
Copy link
Member

@tmeasday tmeasday left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great!

@shilman shilman added the patch:done Patch/release PRs already cherry-picked to main/release branch label Dec 6, 2021
shilman added a commit that referenced this pull request Dec 6, 2021
@bebraw
Copy link
Contributor

bebraw commented Dec 6, 2021

I think this fix should go to manager webpack config as well. I had to patch like this in my project:

module.exports = {
  ...
  managerWebpack: (config) => {
    config.resolve = {
      ...config.resolve,
      fallback: {
        ...config.resolve.fallback,
        path: require.resolve('path-browserify'),
      },
    };

    return config;
  },
}

It seems manager config is missing the shim right now.

@shilman
Copy link
Member Author

shilman commented Dec 6, 2021

@bebraw is the patch something specific to a particular addon or your project's config? i don't think storybook core needs it, but i'm happy to add it if it's causing enough people problems

@bebraw
Copy link
Contributor

bebraw commented Dec 6, 2021 via email

@tmeasday
Copy link
Member

tmeasday commented Dec 6, 2021

Hmmm, I wonder why auto title would be running on the manager side @bebraw. Any chance of a stack trace?

@bebraw
Copy link
Contributor

bebraw commented Dec 6, 2021 via email

@bebraw
Copy link
Contributor

bebraw commented Dec 7, 2021

@tmeasday Here's the trace, https://gist.github.com/bebraw/210b6a2411f53c5063eca40d88bdeace . To keep it simple, I disabled all the addons.

@tmeasday
Copy link
Member

tmeasday commented Dec 8, 2021

@bebraw from that trace it looks like you are importing @storybook/react inside your manager.js -- is that right?

That's a little unexpected but I suppose if you are doing it, others will be too, in which case this polyfill is necessary, certainly outside of 7.0.

@bebraw
Copy link
Contributor

bebraw commented Dec 8, 2021

@bebraw from that trace it looks like you are importing @storybook/react inside your manager.js -- is that right?

That's a good catch.

I see this kind of usage import { addDecorator } from '@storybook/react';. The import explains the trouble.

In my case it seems it's even dead code so I can safely remove it if addDecorator is still supported, likely then the shim config should exist for manager as well.

@tmeasday
Copy link
Member

tmeasday commented Dec 8, 2021

@bebraw -- I wonder why you are using addDecorator in manager.js?

@bebraw
Copy link
Contributor

bebraw commented Dec 8, 2021

@tmeasday It's some older code I didn't write. It's possible the initial usage was simply wrong.

@shilman
Copy link
Member Author

shilman commented Dec 8, 2021

Ok given that, I'm going to close that PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug builder-webpack5 core patch:done Patch/release PRs already cherry-picked to main/release branch patch:yes Bugfix & documentation PR that need to be picked to main branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants