I integrated twin.macro into my svelte project, and everything works as expected, but after making any change, HMR always errors out with "ReferenceError: tw is not defined".
Here's a reproduction repo. Run yarn dev, then make any change in the template, and the error will show up.
The parts of the code using tw, in and out of the template, are replaced with a JS object of the corresponding tailwind styles, but HMR (or something else?) is capturing tw as if it's a reactive component variable, as seen in the compiled output:
$$self.$capture_state = () => ({
css: _emotion_css__WEBPACK_IMPORTED_MODULE_1__["css"],
tw,
bigText
});
I'm not sure what would be the best way around this 🤔 I can provide any additional details as needed
I integrated twin.macro into my svelte project, and everything works as expected, but after making any change, HMR always errors out with "ReferenceError: tw is not defined".
Here's a reproduction repo. Run
yarn dev, then make any change in the template, and the error will show up.The parts of the code using
tw, in and out of the template, are replaced with a JS object of the corresponding tailwind styles, but HMR (or something else?) is capturingtwas if it's a reactive component variable, as seen in the compiled output:I'm not sure what would be the best way around this 🤔 I can provide any additional details as needed