emotion-ts-plugin icon indicating copy to clipboard operation
emotion-ts-plugin copied to clipboard

[question] Can this be used in `compilerOptions`?

Open Andarist opened this issue 5 years ago • 7 comments

I'm wondering if this plugin (or similar) can be added in compilerOptions.plugins? Or does that API doesn't accept transformer plugins?

Andarist avatar Jan 06 '20 14:01 Andarist

This plugin is a transformer plugin, compilerOptions.plugins in tsconfig.json only accept Language service plugin, it's different.

Brooooooklyn avatar Jan 06 '20 15:01 Brooooooklyn

@Andarist Do you have any plan to write a Language service plugin for emotion? Maybe I can help you.

Brooooooklyn avatar Jan 06 '20 15:01 Brooooooklyn

I havent planned to write one, was interested only in transformer plugin for other project. It’s real bummer that those cannot be configured in regular way.

Do you have any ideas what language service plugin could do for emotion?

Andarist avatar Jan 06 '20 23:01 Andarist

What's the status on this? Emotion doesn't allow you to modify the label and sourceMaps options when you're "just" transpiling with tsc... real bummer. Anyone have an alternative solution ?

nicmosc avatar Mar 04 '20 12:03 nicmosc

@nicmosc maybe you need https://github.com/cevek/ttypescript

Brooooooklyn avatar Mar 04 '20 13:03 Brooooooklyn

@Brooooooklyn thanks for the suggestion, the tool looks interesting but not sure how to use this plugin as a transformer, though you do mention above that this is a transformer plugin 🤔 tried this configuration, let me know if you can help out, otherwise i'll look further into it!

... rest of tsconfig.json
    "declaration": true,
    "declarationMap": true,
    "plugins": [
      {
        "transform": "emotion-ts-plugin",
        "import": "createEmotionPlugin",
        "sourceMap": false,
        "autoLabel": true,
        "labelFormat": "[filename]__[local]"
      }
    ]

nicmosc avatar Mar 04 '20 16:03 nicmosc

Scrap that, the transformer seems to be invoked correctly when using ttypescript's ttsc command, but the transpiled file seems to be the same still, autoLabel and labelFormat don't have any effect

nicmosc avatar Mar 04 '20 17:03 nicmosc