-
Notifications
You must be signed in to change notification settings - Fork 185
Transpiling only modules import/export #477
Comments
Turning off all the Traceur options like in the above should work actually. Can you share the error message. Otherwise though #463 is exactly tracking this sort of a change in this project. |
Here's a test:
It works when the traceur options are commented out. When I use the options, I get: The modload dir is available in either of these. The working version (no options) is here: |
Perhaps you're using an 'export const x' feature or similar? This would
|
Actually I'm using the demo from this repo, but without the html (i.e. a blank page with just a script that uses console), and importing the test2.js rather than using system.js. Oh ,, also changed
to the more idiomatic:
I tested it all to make sure I hadn't fat fingered anything by cut/paste test1.js & test2 (w/o 'export') into the Canary console, then cut/paste the script. Worked fine. I.e. Canary did not run across any es6 not yet implemented. The page looks like:
|
More info: I asked on the traceur google group:
|
Ok so I exited the demo.html file in this repo, and added: <script>
System.traceurOptions = { arrowFunctions: false, blockBinding: false, classes: false, computedPropertyNames: false, defaultParameters: false, destructuring: false, forOf: false, generators: false, numericLiterals: false, propertyMethods: false, propertyNameShorthand: false, restParameters: false, spread: false, symbols: false, templateLiterals: false, unicodeEscapeSequences: false, unicodeExpressions: false }
</script> After the Refreshing the page, the demo still works fine for me. Is that what you're after? |
Yup. I probably need to reboot! :) On Tue, Mar 8, 2016 at 4:49 AM, Guy Bedford [email protected]
|
@backspaces Did you find a way to achieve your goal ? |
yeah, there is something screwy here. @backspaces code, such as destructuring to const, works fine in Chrome 49 without traceur, and with standard demo, i.e. transpiling with traceur, but when I add @guybedford traceur options, I get 'Unexpected reserved word const'. Looks like traceur is grabbing the code and preventing the native browser functions from running. It's getting late - I'll try again tomorrow with babel. |
@backspaces I don't think what you want to do will work with the current software.
So I'm not sure that Just transpiling import/export with Babel on Node is easier with v6.
doesn't transpile anything. To transpile all ES6, you would install the ES2015 preset. If you just want to transpile import/export to System.register, install the plugin as described in http://babeljs.io/docs/plugins/transform-es2015-modules-systemjs/. Then
will convert module syntax and leave other ES6 stuff untouched. |
Folks: I never did get it to work so went back to pre-compiling just the module code with Babel,
then using System.js.
This works very well, but alas, does not use the I still need no other Babel transpilation of es6 due to running Chrome & Canary with the experimental flags, (91% & 97% es6 coverage), so as soon as |
This is likely a documentation issue: I would like to configure es6-module-loader so that traceur or babel (<version 6.0, right?) is configured to only transpile modules (import/export). This relates to #463 and #465
This is due to Canary being 96% es6 complete, needing no transpilation, and I would like to standard my use of modules to the
<script type="module">
style due to its being the likely first native module loading by browsers.I've tried turning off all the obvious traceur options, below, but it failed. Is there any way I can set up the traceur or babel options to be modules-only?
System.traceurOptions = { arrowFunctions: false, blockBinding: false, classes: false, computedPropertyNames: false, defaultParameters: false, destructuring: false, forOf: false, generators: false, numericLiterals: false, propertyMethods: false, propertyNameShorthand: false, restParameters: false, spread: false, symbols: false, templateLiterals: false, unicodeEscapeSequences: false, unicodeExpressions: false }
The text was updated successfully, but these errors were encountered: