devongovett / unplugin-parcel-macros

MIT License
224 stars 5 forks source link

Build Issues with using this package on Win Systems #12

Closed adityaras closed 4 weeks ago

adityaras commented 2 months ago

Our Project utilizes Webpack; and we have added the following macros.webpack() to the list of plugins in webpack config.

On Mac platforms everything runs perfectly without any issues but on Win based systems we get a Bad character escape sequence error seemingly due to the styles being loaded in the index file which have a \u in their paths which Win seems to be considering as escape sequences!

adityaras commented 2 months ago

SS of Error (With some paths Blurred)

image

adityaras commented 2 months ago

A potential fix could be simply removing the filename Path in the hash calculation; this avoids issue with how these paths are calculated on different systems

adityaras commented 1 month ago

https://github.com/devongovett/unplugin-parcel-macros/pull/13

devongovett commented 4 weeks ago

This appears to fix the issue for now, but eventually we might need to find a way to add the path back. For example, if you use style({backgroundImage: 'url(../foo.png)'}), the image should be resolved relative to the file that style is called in. However without the file path it will be resolved relative to the root of the project. I tried to fix this but was unsuccessful - looks like it will require changes in unplugin itself - so I bailed for now.