wix / stylable

Stylable - CSS for components
https://stylable.io
MIT License
1.26k stars 62 forks source link

fix(webpack): false positive unused stylesheet collision #2894

Closed idoros closed 11 months ago

idoros commented 11 months ago

This PR fix a case of false positive duplicate namespace error.

There is no test for this case yet, as it is hard to reproduce with our infra, but these are the details:

For some reason, although both imports (component & variant) are resolving the same base stylesheet, webpack is generating 2 modules, one with absolute path from the variant and one relative path from the component.

Our duplicate namespace check gets both modules, with the same namespace! and report the error.

The fix is to filter out the module that is being imported from the variant as it is only used as an interface and isn't important for this check. This is done by checking the isUsed flag we already provide for the module.