Skip to content

Replace grunt-babel with a more TypeScript friendly solution #4

Open
@enlight

Description

@enlight

grunt-babel doesn't pass in source maps to Babel, so the source maps generated by TypeScript will not match the .js source output by Babel. Babel itself accepts source maps as input, so presumably it knows how to transform them along with the .js source files. Another problem with grunt-babel is that TypeScript writes out .js files, and then Babel overwrites them, it'd be better if the .js files were only written out to disk once. I haven't found an existing Grunt task that handles this sort of TypeScript->Babel workflow, so it looks like I'll have to write it myself.

grunt-babel is a good reference on how to use the Babel API, as for TypeScript, the following references will be useful:

  • Using the TypeScript Compiler API
  • dts-generator makes use of the Compiler API, and I've previously messed around with it in my fork.
  • ts-node uses the TypeScript Language Service API, I may end up using this API for the "watch" feature (if I decide to implement it at some point).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions