Skip to content

Detect Node 6 in test environment and disable ES2015 transforms #863

Closed

Description

@gaearon

As mentioned by @cpojer this can significantly speed up the tests. We only need to leave the CommonJS transform from ES6 because Node doesn't support modules yet.

https://twitter.com/cpojer/status/783651892320571394

If you intend to work on this please write in a comment here. If somebody else is already working on it please don't try to beat them. If you later change your mind it's fine but please comment here so somebody else can take the issue.

Activity

  1. gaearon commented on Oct 6, 2016

    @gaearon
    ContributorAuthor

    Update: @shubheksha will work on this.

  2. balanceiskey commented on Oct 6, 2016

    @balanceiskey

    There's a danger, mentioned in the twitter thread, right? Wouldn't this break ES6 style import/exports? I mean I realize it's kind of fake, but if you're trying to keep from writing multiple types of import styles it actually helps to have this on.

  3. MoOx commented on Oct 6, 2016

    @MoOx
    Contributor

    This might be interesting to look at https://github.com/babel/babel-preset-env

  4. cpojer commented on Oct 6, 2016

    @cpojer
    Contributor

    It would still require the ES module transform.

  5. balanceiskey commented on Oct 6, 2016

    @balanceiskey

    Wow I am blind. It says that right there...

  6. afaayerhan commented on Oct 6, 2016

    @afaayerhan

    @cpojer what about async await. if you are a disabling it you would need to document it properly because node 6 does not support async await

  7. cpojer commented on Oct 6, 2016

    @cpojer
    Contributor

    async/await is not part of ES2015.

  8. afaayerhan commented on Oct 6, 2016

    @afaayerhan

    @cpojer was a dummy there was using typescript async await that's why I forgot that async await transform is not applied there

  9. hzoo commented on Oct 6, 2016

    @hzoo

    We're working on https://github.com/babel/babel-preset-env right now (and would appreciate help here). This would figure out the correct plugins to run given the environment (browsers/node/etc)

    With https://github.com/babel/babel-preset-env/pull/12/files were trying to use https://github.com/kangax/compat-table to get the data. In reading the data I'm finding some missing data for node that people can help fill in compat-table/compat-table#932. I can write up a guide on how to do so as well.

    There are also other presets that people have already made (basically turn off plugins and use process.version to detect)
    https://github.com/michaelcontento/babel-preset-modern-node/blob/master/index.js
    https://github.com/rtsao/babel-preset-es2015-node/blob/master/index.js
    and probably others by searching npm

  10. gaearon commented on Oct 11, 2016

    @gaearon
    ContributorAuthor

    @hzoo I just merged a PR that uses -env. I assume it's relatively stable/works, even if incomplete?

  11. hzoo commented on Oct 11, 2016

    @hzoo

    It should be ok - data is at https://github.com/babel/babel-preset-env/blob/master/data/plugins.json and users can add the debug option to console.log the plugins used.

    It's probably more safe than other presets because it checks for 100% implementation before compiling - better to not compile if it implements more than Babel's implementation (another feature).

    Would be a discussion in babel-preset-env's issue but what do we do about partial support (90% usecase, strict mode, etc) babel/babel-preset-env#16

    Should it just use native if the basics or the feature are implemented? https://github.com/rtsao/babel-preset-es2015-node/blob/master/index.js is very lenient

  12. gaearon commented on Oct 11, 2016

    @gaearon
    ContributorAuthor

    We're going to always pick the safest option possible as it's just an optimization.

  13. hzoo commented on Oct 11, 2016

    @hzoo

    👍 Might be overkill but it would be interesting to get data on what fails to see what features in compat-table users are transpiling (most likely the non 100% versions would still work).

    we should totally do this in babel as well 😄

  14. locked and limited conversation to collaborators on Jan 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions