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

Default to es2017 #35

Closed
dhh opened this issue Dec 20, 2016 · 15 comments
Closed

Default to es2017 #35

dhh opened this issue Dec 20, 2016 · 15 comments

Comments

@dhh
Copy link
Member

dhh commented Dec 20, 2016

Let's give the people async/await by default (and the other es2017 goodies).

@guilleiguaran
Copy link
Member

Done in af32076

@hiroppy
Copy link
Contributor

hiroppy commented Dec 20, 2016

Cool 😄

@flybayer
Copy link

flybayer commented May 4, 2017

Async/await is not working for me in version 1.2 without installing and loading babel-polyfill

Should I create a new issue or do you want to reopen this one?

@gauravtiwari
Copy link
Member

@flybayer What version of node you got?

@flybayer
Copy link

flybayer commented May 4, 2017

Node 7.10.0

@gauravtiwari
Copy link
Member

thanks, and you got .babelrc with env preset?

@flybayer
Copy link

flybayer commented May 4, 2017

I should have added the error I get in the Browser console without babel-polyfill:

Uncaught ReferenceError: regeneratorRuntime is not defined

My .babelrc:

{
  "presets": [
    ["env", {"modules": false}]
  ],
  "plugins": [
    "transform-object-rest-spread",
  ],
}

@gauravtiwari
Copy link
Member

gauravtiwari commented May 4, 2017

You would need to use this option - https://github.com/babel/babel-preset-env#usebuiltins-boolean

See this issue - babel/babel-preset-env#92

@gauravtiwari
Copy link
Member

I guess something like this would work, please give it a go -

    "presets": [
      [
        "env",
        {
          "targets": {
            "node": "current"
          },
          "useBuiltIns": true
        }
      ]
    ]

@gauravtiwari
Copy link
Member

We should probably update .babelrc

{
  "presets": [
    ["env", {
      "modules": false,
      "targets": {
        "node": "current"
      },
      "useBuiltIns": true
    }]
  ]
}

@gauravtiwari gauravtiwari reopened this May 4, 2017
@flybayer
Copy link

flybayer commented May 4, 2017

This works perfect!! (without babel-polyfill). Thank you @gauravtiwari !!

{
  "presets": [
    ["env", {
      "modules": false,
      "targets": {
        "node": "current"
      },
      "useBuiltIns": true
    }]
  ]
}

@flybayer
Copy link

So this changed worked fine until I tried to run in production mode which results in uglify failing because of ES6/7 syntax (see #306).

I'm now back to using babel-polyfill and:

{
  "presets": [
    ["env", {
      "modules": false,
      "targets": {
        "node": "current",
        "uglify": true
      },
      "useBuiltIns": true
    }]
  ]
}

@gauravtiwari
Copy link
Member

Lets document this in README @flybayer as this depends on the use case

@MiguelSavignano
Copy link

in webpacker (3.2.0)
Add the babel plugin transform-runtime

npm install babel-plugin-transform-runtime

{
  "presets": [
    [
      "env",
      {
        "modules": false,
        "targets": {
          "browsers": "> 1%",
          "uglify": true
        },
        "useBuiltIns": true
      }
    ]
  ],
  "plugins": [
    "syntax-dynamic-import",
    "transform-object-rest-spread",
    "transform-runtime",
    [
      "transform-class-properties",
      {
        "spec": true
      }
    ]
  ]
}

@nathanbirrell
Copy link

Thanks @MiguelSavignano. This solved the Uncaught ReferenceError: regeneratorRuntime is not defined issue for me too.

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

7 participants