Skip to content
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] Is there any way to transpile to vanilla js? No commonjs or adm. #3322

Closed
ericmdantas opened this issue May 31, 2015 · 5 comments
Closed
Labels
Question An issue which isn't directly actionable in code

Comments

@ericmdantas
Copy link

Hello!

I'm trying to build a module that the user (developer) will consume by either using:

  • Pure javascript: He'll have my class loaded in the global scope, for example.
  • Commonjs: He'll be able to call it using require - and maybe with SystemJS.
  • AMD: He'll be able to use it with RequireJS and maybe with SystemJS.
  • ES6: He'll be able to use it with the ES6 syntax.

So, right now I'm using gulp-typescript to transpile my code to the dist folder. I transpile once for commonjs, once for amd, once for es6.. but it seems that there's no way to transpile to pure Javascript (other than using the module syntax inside my .ts file).

Is there any way to accomplish this?

Thanks in advance!

@LPGhatguy
Copy link
Contributor

For vanilla case, CommonJS and AMD, you could wrap your code in a UMD loader.

I'm fairly sure that detecting ES6 loading capability is still an unsolved problem.

@DanielRosenwasser
Copy link
Member

As per #2036 we'll have the umd option for the --module flag in 1.5, but I don't think it covers the "standard JS" case.

@ericmdantas
Copy link
Author

@LPGhatguy, @DanielRosenwasser: well, I'll have to wait for 1.5 then.

Do you guys know if SystemJS compatibility is also target for 1.5?

@DanielRosenwasser
Copy link
Member

Do you guys know if SystemJS compatibility is also target for 1.5?

Yes I do and yes it is. 😄

Also see our list of compiler options.

@ericmdantas
Copy link
Author

Awesome!

Thank you!

@DanielRosenwasser DanielRosenwasser added the Question An issue which isn't directly actionable in code label Jun 1, 2015
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Question An issue which isn't directly actionable in code
Projects
None yet
Development

No branches or pull requests

3 participants