-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Question: how to emit code that is seen by other plugins #1404
Comments
Unless I'm severely overcomplicating things, this needs a way to inject types into ts language service (even if css plugin manages to deliver them through rollup somehow). There is a feature proposal on typescript side (microsoft/TypeScript#3136), but nothing I can find that already allows for it. Another option would be to wrap css output in a full ts module (as a different plugin sitting between css and ts), and make sure it gets resolved correctly before ts tries to find the actual file. If you need to get something working now, you might have to preprocess css files to have d.ts files ready before typescript plugin even initializes. |
yes probably 🙁
i don’t understand what you mean here, could you please elaborate?
yup, that’s what i did until now. but as said, i’d like to avoid its problems. |
I mean if you make plugin take css and output valid typescript module instead of whatever it does now (js?). By module I mean something with export and valid typescript code, same thing you do with d.ts, but inline. Then add *.css to typescript plugin input glob and it will be fed to typescript for transpiling. This will not help with IDE support at all though. |
oh yes, for IDE support, we need plugin support in the typescript language server. didn’t think about that. so there’s three options:
thank you! |
Specifically, I want to make
rollup-plugin-typescript2
to see something it can understand when it tries to import a.css
file. statically, that can be done by creating a.css.d.ts
file next to it containing something likebut that approach has two problems:
.d.ts
file(s)So if i don’t want to create the
.d.ts
files as a separate step, the problem is that i need two plugins to interact:rollup-plugin-typescript2
seesimport style from style.css
rollup-plugin-*css*
somehow gets to provide the code for that module (which is seen by typescript)rollup-plugin-typescript2
’s type checker is happy androllup-plugin-typescript2
emits JS coderollup
bundles itis this even possible?
cc @ezolenko
The text was updated successfully, but these errors were encountered: