Bug report
It looks like it ignores .babelrc config when I try to build an app. for production.
.babelrc
{
"plugins": ["@babel/plugin-transform-object-assign"]
}
ts
const t = Object.assign({}, {a: 1})
package.json
"scritps": {
"start": "cross-env NODE_ENV=development parcel index.html",
"build": "cross-env NODE_ENV=production parcel build src/main.ts --out-dir build/ --no-minify",
}
So, if I use development mode, all things look good, and Object.assign is polyfilled in the dist bundled file [hash].js:
...
var _extends = Object.assign || function (target) { ...
...
r = _extends({}, { a: 1 });
...
But, when I start build script, I getting no transpiled code in the result file:
r = Object.assign({}, { a: 1 });
production build should extend Object.assign
production build ignore plugin, described in the .babelrc
| Software | Version(s) |
| ---------------- | ---------- |
| Parcel | 1.2.0
| Node | 8.4.0
| Yarn | 1.0.2
| Operating System | macOS high Sierra 10.13.2
| Typescript | 2.6.2
Did you by chance create your .babelrc at the very end? What happens if you build with --no-cache or manually just rm -r .cache/. I just experienced something similar after adding my .babelrc as the final step. It turns out that configuration changes are not picked up with the cache, e.g., https://github.com/parcel-bundler/parcel/issues/509#issuecomment-355896029
@mrcoles thanks I was having this problem.
yep, looks like .cache was an issue. Now it works fine for me, thanks!
Btw, I created #777 about this. I looked a little into how it could be solved, seems like a hacky approach would be to just include in the cache the existence-or-not of each file: [.babelrc, .babelrc.js, .postcssrc, .postcssrc.js, postcss.config.js, .browserslistrc, .posthtmlrc, posthtml.config.js] and if the exists-or-not state changes for any, invalidate the cache. (put discussion in that issue, not here)
Most helpful comment
Did you by chance create your
.babelrcat the very end? What happens if you build with--no-cacheor manually justrm -r .cache/. I just experienced something similar after adding my.babelrcas the final step. It turns out that configuration changes are not picked up with the cache, e.g., https://github.com/parcel-bundler/parcel/issues/509#issuecomment-355896029