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

[Bug]: Styling and CSS (Uncaught TypeError: __webpack_require__.n is not a function) #19981

Closed
LukasMachetanz opened this issue Nov 28, 2022 · 14 comments

Comments

@LukasMachetanz
Copy link

LukasMachetanz commented Nov 28, 2022

Describe the bug

Having a storybook-configuration with custom styles within an nx-workspace throws an unexpected error within the browser console - see screenshot.

Screenshot 2022-11-28 at 10 56 46

Using Cypress together with storybook results in failing test suite of the e2e specs as an uncaught exception is thrown due to this bug.

To Reproduce

  • Create a nx-workspace like npx create-nx-workspace my-workspace
    • Choose your style: integrated
    • What to create in the new workspace: angular
    • Application name: web-app
    • Default stylesheet format: SCSS
    • Enable distributed caching to make your CI faster: No
  • Create a library like nx g @nrwl/angular:lib my-lib
  • Create a component within the library like cd libs/my-lib/src/lib and nx g @nrwl/angular:c my-comp
  • Create a storybook-configuration for the generated library like nx g @nrwl/angular:storybook-configuration my-lib (all questions can be answered with yes)
  • Create a stylesheet styles.scss and include it within the section build:storybook of project.json as explained in Styling and CSS - "styles": ["libs/my-lib/src/styles.scss"]
  • Start storybook with nx run my-lib:storybook
  • Have a look at the console in the browser
@samvloeberghs
Copy link

Seems to be fixed with last version of nx and storybook libraries.
Can you try upgrading? @LukasMachetanz

@LukasMachetanz
Copy link
Author

I run nx migrate latest which installs version 15.2.4 of @nrwl/storybook, but the problem still exists. Which version do you use @samvloeberghs?

@Mairu
Copy link

Mairu commented Dec 8, 2022

FYI: For us usage of version 15.2.4 removed the problem.

@samvloeberghs
Copy link

Same here; 15.2.4 fixed it.
Also check your storybook dependencies to be latest @LukasMachetanz

@LukasMachetanz
Copy link
Author

I can confirm that the described issue is resolved using the latest versions.

@samvloeberghs
Copy link

samvloeberghs commented Dec 15, 2022

The bug reappeared when I migrated to latest nx:
v15.2.4 to v15.3.3.
Storybook dependencies remained the same.

@LukasMachetanz can you please re-open?

@jogelin
Copy link

jogelin commented Dec 16, 2022

Same here, doing the migration to latest Nx 15.3.3 and storybook 6.5.14 and I have:
image

I found related PR here:

@shilman
Copy link
Member

shilman commented Dec 16, 2022

We probably need to patch this back to 6.5 also @valentinpalkovic WDYT?

#20287

@samvloeberghs
Copy link

samvloeberghs commented Dec 20, 2022

@shilman @valentinpalkovic can you please re-open the issue to be sure we track this?
Thanks a lot for investigating this!

@shilman
Copy link
Member

shilman commented Dec 20, 2022

@samvloeberghs it's patched back here. can you please test? https://github.com/storybookjs/storybook/releases/tag/v6.5.15-alpha.1

@jogelin
Copy link

jogelin commented Dec 20, 2022

@shilman @samvloeberghs for me it works!

Let's migrate all Angular Material Components from legacy to v15 now :D

@shilman
Copy link
Member

shilman commented Dec 20, 2022

Nice!! I'll do a full release now

@samvloeberghs
Copy link

@shilman
Can also confirm it works, thanks, you guys rock!

@LukasMachetanz
Copy link
Author

@samvloeberghs, sorry for reopening the issue so late.

It seems that the problem is resolved again and that the issue can be closed, right?

@shilman shilman closed this as completed Jan 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants