Skip to content

Add file extension to preprocessor #55

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

Merged
merged 1 commit into from
Aug 4, 2017

Conversation

mfeckie
Copy link
Contributor

@mfeckie mfeckie commented Aug 4, 2017

After learning way more about the internals of broccoli and ember-cli than I'd expected to today ...

Using broccoli-stew to print out the inputNode in toTree, I noticed that it was being passed

include: [/js$/]

This seems to only be the case for the addon directory, which is why I think it wasn't breaking in 'normal' app usage. The toTree hook gets called three times (addon, app and tests). The tree received when invoked by app is quite different to the one from addon.

After digging around I noticed in here https://ember-cli.com/api/classes/Addon.html#method_setupPreprocessorRegistry that the file extension is used to determine the tree that the preProcessor receives.

Adding the extension to the TypeScriptPreprocessor changes it to this

include: [/js$/, /ts$/]

Which results in the typescript files being correctly passed to the tsc compiler.

@chriskrycho
Copy link
Member

Ahhhh, very nice catch there—thanks @mfeckie and @twokul!

@chriskrycho chriskrycho merged commit d94e05a into typed-ember:master Aug 4, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants