glromeo / esbuild-sass-plugin

esbuild plugin for sass
MIT License
155 stars 40 forks source link

Resolving url() with CSS Modules #146

Closed silvenon closed 1 year ago

silvenon commented 1 year ago

Hey! I love your plugin and the dedication you're putting into it ❤️

I carefully read the docs, related issues, test fixtures, but I wasn't able to find the solution for my problem.

The repro is here: https://github.com/silvenon/repro/tree/5a2567b78dae490ea38d52b66a027fe4c71c5f23 (if you're going to clone it, notice that the branch is esbuild-sass-modules-url, not the default master)

My use case is resolving url() in (S)CSS Modules. The build succeeds if I remove postcssModules and even precompile, but I haven't managed to get the url() working with postcssModules.

Any ideas? 🙏

glromeo commented 1 year ago

Thank you for giving me the context to look at this issue with ease! I ran your repro and the error I was getting pointed me to an oversight I did when implementing the css-chunks for which resolveDir was missing and therefore esbuild wasn't able to resolve the relative url of your svg. I fixed that and your build seems OK. Please try v2.14.0 and feel free to reopen this issue if I missed something.

silvenon commented 1 year ago

Wow, thanks for such a speedy rescue, it works! ❤️