Bugfix: Error when using Sveltekit/Typescript
Closed this issue · 1 comments
Derek-Devs commented
Hello,
When running a dev server with this plugin I encountered the following error:
[postcss] color.replace is not a function
VS Code/Typescript pointed me to the index.js of this plugin on line 38
Originally:
.replace("{{color}}", color.replace("#", "%23"))
Typescript didn't like this, so I updated the replace method call to 'color.toString().replace("#", "%23")' which first converts the object to a string before calling the replace method.
This resolved the issue, final replacement code for line 38 below:
.replace("{{color}}", color.toString().replace("#", "%23")).
As far as I can tell this should not cause any issues with other technologies using this plugin, and will make it play nice with Typescript.