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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is babelrc being ignored? #509

Closed
lucaseverett opened this issue Jan 7, 2018 · 6 comments
Closed

Is babelrc being ignored? #509

lucaseverett opened this issue Jan 7, 2018 · 6 comments

Comments

@lucaseverett
Copy link

Choose one: is this a 馃悰 bug report or 馃檵 feature request?

This is possibly a bug.

馃帥 Configuration (.babelrc, package.json, cli command)

.babelrc

{
  "presets": ["env"]
}

.browserslistrc

last 1 Firefox versions

馃 Expected Behavior

regeneratorRuntime shouldn't be used since I'm targeting only the most recent Firefox version, which natively supports async/await.

馃槸 Current Behavior

ReferenceError: regeneratorRuntime is not defined

馃敠 Context

Using babel-polyfill works, but since I'm creating a Firefox extension targeting the most recent version of Firefox, I don't want to transform async/await.

@lucaseverett
Copy link
Author

Here is a link to my Firefox extension this happened with. I've removed async/await rather than use the polyfill, but I haven't changed babelrc or browserslistrc from what it was when the issue happened.

https://github.com/lucaseverett/Firefox-Toolbar-Dial

Am I doing something incorrect in my setup? Am I wrong that async/await shouldn't be transformed into regeneratorRuntime when targeting "last 1 Firefox versions"?

@jgrassini
Copy link

I encountered a similar problem. It looks like that Parcel (or Babel?) ignores .browserslistrc
It should work when you add the query directly into .babelrc

{
    "presets": [
      [ "env", {
        "targets": {
          "browsers": "last 1 Firefox versions"
        }
      }]
    ]
  }

But why do you use Babel at all when you target a modern browser?

@jgrassini
Copy link

Mystery solved. It's not implemented in the current version of babel-preset-env (1.6.1).
Support for browserslist comes with version 2
babel/babel-preset-env#161

@lucaseverett
Copy link
Author

I also tried adding it directly in babelrc and that didn't make a difference, in my case.

I'm using Parcel for bundling. I don't know of any way to disable Babel and still be able to do that. I tried removing all references to Babel -- including deleting the babelrc file and removing preset-env from package.json -- but that didn't make a difference for my issue.

@jgrassini
Copy link

To disable Babel you remove the .babelrc file

Do you use the --no-cache option when you build the project?
parcel build --no-cache ....

With the cache Parcel does not pick up configuration changes when the code did not change.

@lucaseverett
Copy link
Author

Perfect, --no-cache solves the issue. Also, I tried using the babelrc you provided and that worked as well. So, I must have had a typo when I tried it earlier.

Thanks for your help! This issue is now resolved.

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

2 participants