Skip to content
This repository was archived by the owner on Dec 1, 2019. It is now read-only.

getCustomTransformers are not being used when running with dev server #447

Closed
Igorbek opened this issue Jun 15, 2017 · 5 comments · Fixed by #531
Closed

getCustomTransformers are not being used when running with dev server #447

Igorbek opened this issue Jun 15, 2017 · 5 comments · Fixed by #531

Comments

@Igorbek
Copy link

Igorbek commented Jun 15, 2017

I'm using options.getCustomTransformers to supply custom transformations to the TypeScript emitter.
It looks like they only work when webpack creates static bundles.
The method doesn't get called at all, when dev-server is running with HMR.
Is anything can be done in order to support customer transformers in that mode?

@s-panferov
Copy link
Owner

In "watch" mode our type-checking happens in another process and we need to find some way to pass transformers to that process.

@Igorbek
Copy link
Author

Igorbek commented Jun 16, 2017

Do you use emit api in that mode? Is that where the transpiling in the watch mode happening: https://github.com/s-panferov/awesome-typescript-loader/blob/master/src/checker/runtime.ts#L385 ?

@Igorbek
Copy link
Author

Igorbek commented Jun 16, 2017

If so, looks like ts.transpileModule is pretty simple (https://github.com/Microsoft/TypeScript/blob/master/src/services/transpile.ts#L26-L112) and creates a compiler host internally. So that it would be a good optimization to do this work manually.

Other option, which obviously is easier, is to pass transformers?: CustomTransformers as part of transpileOptions.

@guncha
Copy link
Contributor

guncha commented Oct 10, 2017

I really needed this to work so I made the necessary changes. Basically what you suggested, @Igorbek. @s-panferov if you're interested, I'm happy to write specs, document and open a proper PR.

master...guncha:fix-custom-transformers

@Igorbek
Copy link
Author

Igorbek commented Oct 10, 2017

That's great @guncha. That would be great if you open a PR. I have a suggestion though, that I raised here #423 (comment), but it can be discussed later in your PR.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants