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

bundling is not transpiling es6 #478

Closed
u9520107 opened this issue Feb 5, 2015 · 9 comments
Closed

bundling is not transpiling es6 #478

u9520107 opened this issue Feb 5, 2015 · 9 comments

Comments

@u9520107
Copy link

u9520107 commented Feb 5, 2015

I was under the impression that bundling would trigger transpiling if sources contain es6 code. But I just happened to include a project with generators used in the source, and found that the generator was passed to the client without being transpiled. Furthermore, when system.js failed to fetch stuff from the bundle, it seems to attempt to import the unbundled source, which somehow the es6-module-loader also failed to transpile the code on the fly.
Tested in osx and windows with JSPM version 0.11.3, and node version 0.11.14.

right.. the project I included was tj/co@0.4.2

@guybedford
Copy link
Member

@u9520107 ES6 transpilation only happens for ES6 modules, not ES6 files written in CommonJS.

Transpiling ES6 features for other module formats can certainly be a feature to consider.

@evenfrost
Copy link

This exact question has raised for me today. So, transpilation is "activated" only for ES6 modules, i.e. files that have either 'import' or 'export' statements in them, and not for every ES6-syntax file in project code folder, right?

@guybedford
Copy link
Member

Yes exactly. If you have an ES6 file with no module syntax, you can add "format es6" to the top of the source to ensure jspm treats it as ES6.

@u9520107
Copy link
Author

u9520107 commented Feb 5, 2015

@guybedford What if is someone else's code? Is there a possibility at install time to specify that the module should be treated as es6?

@guybedford
Copy link
Member

Yes this is done with overrides - jspm install repo -o { format: 'es6' }

@u9520107
Copy link
Author

u9520107 commented Feb 5, 2015

@guybedford cool.. I'll try definitely try that out. Probably enough to fixed the problem for me.

@u9520107
Copy link
Author

u9520107 commented Feb 6, 2015

@guybedford Turns out that transpiling the aforementioned package doesn't fix the issue I had. The problem is with the package itself though. They should be releasing a new version that'd fix the issue pretty soon.
Thanks for the help.

Closing this since it's not really jspm's problem.

@u9520107 u9520107 closed this as completed Feb 6, 2015
@fernandogmar
Copy link

Hello!

It seems I am getting a similar problem... and { format: 'es6' } is not doing anything.

The file is transpiled on the browser (even without format es6) but bundling is not transpiling it at all... maybe I am missing something and for the current version should be done in a different way....

any help would be appreciated. Thanks!

@sergueyarellano
Copy link

@fernandogmar Did you try something like this in your config?

  packages: {
    "tj/co@0.4.2": {
      "meta": {
        "*.js": {
          "format": "es6"
        }
      }
    }
  }

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

No branches or pull requests

5 participants