Skip to content
This repository has been archived by the owner on Sep 26, 2023. It is now read-only.

Broken with css-loader >= 6.0.0 #22

Closed
volkyeth opened this issue Feb 9, 2022 · 5 comments · Fixed by #49
Closed

Broken with css-loader >= 6.0.0 #22

volkyeth opened this issue Feb 9, 2022 · 5 comments · Fixed by #49

Comments

@volkyeth
Copy link
Contributor

volkyeth commented Feb 9, 2022

Describe the bug

Due to this breaking change on css-loader 6.0.0:

for url and import options Function type was removed in favor Object type with the filter property, i.e. before { url: () => true }, now { url: { filter: () => true } } and before { import: () => true }, now { import: { filter: () => true } }

And due to the the version constraint ^6.5.1 the addon is broken because of current css-loader config that uses old format

requiring [email protected] (before the breaking changes) is a workaround

Your minimal, reproducible example

the repo examples should all be failing on storybook start 🤔

Steps to reproduce

install with css-loader >6.0.0

Expected behavior

storybook should start

How often does this bug happen?

Every time

Screenshots or Videos

No response

Platform

macOs

storybook-addon-next version

1.4.2

Additional context

No response

@RyanClementsHax
Copy link
Owner

Hi! Thanks for opening this issue.

I'm having trouble recreating the issue. All of the examples work just fine for me. Could you create a minimal reproduction example?

It might help to know that I recently found out that because of some package resolutions that storybook has, the version of css loader that's actually resolved is v3.x. This leads me to ask the following question: is this a bug that in theory should happen, or is this something you're actually seeing?

Btw, I agree, it's totally expected to think that this addon should break given the info you just gave.

@RyanClementsHax RyanClementsHax added the needs reproduction example It is missing or waiting on a reproduction case to be provided label Feb 10, 2022
@volkyeth
Copy link
Contributor Author

volkyeth commented Feb 10, 2022

Ok, this is more complex than I thought at first. The issue is surfaced in my project by a workaround to #23 that is using "nohoist" on the yarn workspace to keep the node_modules of storybook-addon-next on the same folder it's used, like so:

Doing this decouples the versions of css-loader required by other dependencies from the one required by storybook-addon-next ([email protected]), making the error I reported manifest.

I would still say this is a bug, despite manifesting only in specific circumstances, because storybook-addon-next is incorrectly reporting it supports css-loader >= 6.0.0, so if the other dependencies upgraded their css-loader version this package would break in regular scenarios too.

I'm still trying to setup a minimal reproduction scenario based on the one I created for #23, but it's becoming a nightmare because it seems the upstream storybook packages don't bode well with yarn workspaces too :/

@volkyeth volkyeth changed the title Broken with css-loader > 6.0.0 Broken with css-loader >= 6.0.0 Feb 10, 2022
RyanClementsHax added a commit that referenced this issue Feb 11, 2022
- remove css-loader (not even needed)
- remove style-loader (not even needed as well)

fixes #22
@RyanClementsHax RyanClementsHax removed the needs reproduction example It is missing or waiting on a reproduction case to be provided label Feb 11, 2022
@RyanClementsHax
Copy link
Owner

So turns out css-loader isn't even needed as a dependency so removing the dependency altogether should work for you right?

See #25

@RyanClementsHax
Copy link
Owner

RyanClementsHax commented Feb 16, 2022

@volkyeth I'm pretty much good to go with your solution in #24. I'm just wondering if updating the examples' yarn.lock files would be a nice sanity check to make sure everything installs properly (I've been bitten by package resolution errors one too many times)

@github-actions
Copy link

github-actions bot commented Mar 4, 2022

🎉 This issue has been resolved in version 1.6.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.