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

Plugin request: add transpilation support for es6 to es5 #1303

Open
bit-shifter opened this Issue Mar 25, 2015 · 3 comments

Comments

Projects
None yet
3 participants
@bit-shifter
Contributor

bit-shifter commented Mar 25, 2015

Since there is also a plan to support NPM libraries within BRJS, if we also supported ES6 modules within BRJS then we would end up with five types of module:

  • NPM Modules (should also be able to support ES6)
  • ES6 Modules
  • CommonJS Modules
  • Namespaced Modules
  • Thirdparty Modules

The easiest way to make all of these modules work together is by using the ES6 bundle format as a common bundle format for all module types, where require() is changed to merely proxy through to System.import().

This would work as follows:

  • NPM Modules (transpiled using babelify)
  • ES6 Modules (transpiled using Babel)
  • CommonJS Modules (modified to use System.register() instead of define())
  • Namespaced Modules (modified to use System.register() instead of define())
  • Thirdparty Modules (modified to use System.register() instead of define())

In this way, modules would be free to depend on modules of other types. Even NPM Modules that aren't allowed to depend on modules that are not also within NPM could get around this by using System.import() instead of import.

To continue supporting CommonJS & Namespaced tests that rely on sub-realms and/or global API overriding to dynamically replace modules for the duration of a test, the sub-realms feature of browser-modules will need to be proxied through to System.set(), which ES6 developers would be free to invoke directly.

@dchambers

This comment has been minimized.

Show comment
Hide comment
@dchambers

dchambers Mar 27, 2015

Contributor

I suggest we close this issue until after #445 has been implemented, and re-open again once people have had a chance to adapt to life with NPM module support, and then re-evaluate whether we still need this after that. @andyberry88, what do you think?

Contributor

dchambers commented Mar 27, 2015

I suggest we close this issue until after #445 has been implemented, and re-open again once people have had a chance to adapt to life with NPM module support, and then re-evaluate whether we still need this after that. @andyberry88, what do you think?

@andyberry88

This comment has been minimized.

Show comment
Hide comment
@andyberry88

andyberry88 Mar 30, 2015

Member

I was talking with @bit-shifter and suggested he raise this issue but I think you're right @dchambers. After we've added NPM module support and adopt a more micro library type approach where libraries can written independently that may make this less of a requirement.

Member

andyberry88 commented Mar 30, 2015

I was talking with @bit-shifter and suggested he raise this issue but I think you're right @dchambers. After we've added NPM module support and adopt a more micro library type approach where libraries can written independently that may make this less of a requirement.

@dchambers

This comment has been minimized.

Show comment
Hide comment
@dchambers

dchambers Apr 30, 2015

Contributor

This issue is being re-opened before we do the NPM integration work since it's become clear that the design of that work will be affected by how we eventually allow ES6 support in BRJS code.

Contributor

dchambers commented Apr 30, 2015

This issue is being re-opened before we do the NPM integration work since it's become clear that the design of that work will be affected by how we eventually allow ES6 support in BRJS code.

@dchambers dchambers reopened this Apr 30, 2015

@dchambers dchambers referenced this issue May 13, 2015

Closed

SPIKE: Convert BRJS to use SystemJS #1389

2 of 3 tasks complete

@andyberry88 andyberry88 added this to the 1.1 milestone May 19, 2015

@dchambers dchambers modified the milestones: Post 1.0, 1.1 Jun 5, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment