wix / stylable

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

Document the reasons why `duplicate namespace error` can occur #2028

Open barak007 opened 3 years ago

barak007 commented 3 years ago

Describe your issue

Duplicate namespace "Button123456789" found in multiple different resources:
...
...
This issue indicates multiple versions of the same library in the compilation, or different paths importing the same stylesheet like: "esm" or "cjs".

Stylable emits this error but does not give a clear way for how to solve/investigate the problem.
This is because usually the solution is not in the Stylable domain and related to package (npm) composition and build strategies.

Since we don't want to explode the error message with text. We can create a page in Stylable.io explaining this error (and maybe all the errors), then we can just give an additional link in the error description that will give extra information for the next steps.

Additional Context

No response

barak007 commented 3 years ago

WIP

Why this happens?

This error can occur when using a 3rd party packages that contains esm and cjs dists and somewhere in code an import is resolved once to the esm dist and in the same build to the cjs dist. This can happen if there is a direct dist import

How to fix?

duplicate-namespace-error-fix-flow