Choose one: is this a 馃悰 bug report or 馃檵 feature request?
馃悰 bug report
The site mentions:
Parcel automatically runs these transforms when it finds a configuration file (e.g. .babelrc, .postcssrc) in a module.
But Parcel is automatically running my JS file through babel and "breaking the code" (1. finds await; 2. turns it into regeneratorRuntime; 3. doesn't include regeneratorRuntime)
Does Parcel require a babel configuration or not? The docs make it sounds like one has to install and configure babel-preset-env but apparently it does so without any config.
Moreover, babel-preset-env is still run even if I provide this .babelrc configuration:
{"presets": []}
The only thing that worked:
# .browserlistrc
last 1 Chrome version
No configuration:
npm run watch
{
"license": "MIT",
"scripts": {
"watch": "parcel index.html"
},
"dependencies": {},
"devDependencies": {
"parcel-bundler": "^1.7.1"
}
}
node_modules is clean and up to date. No babel is installed.
No babel processing
JS file is transformed by babel from await/async into regeneratorRuntime code.
| Software | Version(s) |
| ---------------- | ---------- |
| Parcel | 1.6.2
| Node | v9.8.0
| npm/Yarn | 5.8.0
| Operating System | macOS 10.13.4
By default it runs babel-preset-env
There are two issues then:
.babelrc (that excludes any presets) isn't followedI had similar problems, and to be honest sometimes I feel like it causes more troubles than it solves. IMO we should only use babel-preset-env if there is a browserlist or similar field in package.json of the project or module. If the user don't ask for await to be transpiled then it should not. This may be resolved by the coming source feature though.
As a workaround you can use last 1 Chrome version as targets.browsers :
.babelrc{
"presets": [
["env", {
"targets": {
"browsers": ["last 1 Chrome version"]
}
}]
]
}
Hey guys! Was stuck by this one yesterday while trying to use fast-async instead of transform-regenerator for faster async functions. Looks like parcel doesn't respect project's .babelrc file, as running transforms with babel-cli does the trick.
@kadmil Hit this too.
I'm suggesting using user-defined preset if they defined presets. Don't merge.
This zero config thing is turning out more confusing that it should be, it is not zero config, it is a collection of defaults configs that can be overwritten but we don't know the defaults so we have to dig in the github issues for answers :( maybe just better docs?
Feel free to open a PR or issue with improvement suggestions @psypersky https://github.com/parcel-bundler/website
It transpiles using babel even if there is no .babelrc so this is a bug. The website should not be changed, the bundler should be
This is not a bug, it is a feature and it has been discussed at length. Going to lock this conversation. Please open a new issue if you have an actual bug.
Most helpful comment
I had similar problems, and to be honest sometimes I feel like it causes more troubles than it solves. IMO we should only use
babel-preset-envif there is abrowserlistor similar field inpackage.jsonof the project or module. If the user don't ask forawaitto be transpiled then it should not. This may be resolved by the comingsourcefeature though.As a workaround you can use
last 1 Chrome versionastargets.browsers:.babelrc