Skip to content

Compatibility with macros (or any erased-at-compile-time symbol) #15

Open
@itsMapleLeaf

Description

@itsMapleLeaf

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions