-
Notifications
You must be signed in to change notification settings - Fork 187
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
Tighten webpack rule merge rules to prevent clashes #376
Tighten webpack rule merge rules to prevent clashes #376
Conversation
🦋 Changeset detectedLatest commit: 31f06c1 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Hi @askoufis 👋, You seem the be the most active maintainer, so was wondering if you could have a look at my small bug fix PRs 🙏🏼 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR!
@AntoLepejian It seems your fork is a bit restrictive and won't run CI checks. |
@askoufis interesting. I have no idea why, lemme check |
@askoufis I think you have to approve it?
|
Oh my bad, I think I approved it before but then merged my suggestion so I think it got cancelled or something. |
Hey @AntoLepejian, I'm going to revert this change. It has broken our internal usage of playroom, and the workaround (without reverting this change) isn't very practical. In our case, because we can no longer easily override playroom's CSS handling, we end up with From digging up a bit of context around the config merging feature, I think keeping the merge scoped to just the Happy to chat more about your specific use case so we can reach a solution that works for everyone, but until then I'll need to revert this change. |
@askoufis thanks for getting back to me with an explanation! Obviously if this has broken your internal usage of playroom, then we need to revert it 😂 I was tackling this from a consumer's POV, where I'd want to BYO my loaders without impacting playroom's ones whatsoever; and vice versa, by creating a clear separation boundary. So to me your workaround (which was deemed impractical) semantically made sense. But I can see arguments for both. I understand you'd want to override the config, so I'm happy to also try recreating playroom's loaders when I override the CSS loader, which means I may not need this PR to land, thanks for the suggestion! The only action needed might be to communicate this via JSDocs, or in the readme :) |
@askoufis so i've come up with a workaround to unblock myself. I need to add separate CSS loaders for separate files, and now that I understand the problem, I can bypass it. One of my css rules is now Not pretty, but will do for now 🙂 |
Problem
Playroom has its own webpack config, and has the ability for consumers to provide their own, which are both merged to create a single webpack config.
The merge matches rules, i.e. determines their uniqueness only by comparing the
test
property of a rule. So if a consumer tries to add a module rule with the same test as one of playroom's own configs, they will be treated as equal and thus one will override the other.e.g.
In the above example, both rules are considered equal, so one will take precedence, leading to a misconfiguration.
Solution
Include the
include
andexclude
properties in the comparison too, to ensure a rule is uniquely identified by all 3 propertiestest
,include
andexclude
.