parcel: πParcel do not transpile some ES6+ code in node_modules
Choose one: is this a π bug report or π feature request?
πbug
π Configuration (.babelrc, package.json, cli command)
// .babelrc
{
"presets": [
["env", {
"targets": {
"browsers": ["IE 9"]
}
}]
],
}
// package.json
{
"name": "pc",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"devDependencies": {
"babel-core": "^6.26.0",
"babel-preset-env": "^1.6.1",
"parcel-bundler": "^1.6.2"
},
"private": true,
"scripts": {
"build": "parcel build src/index.js"
},
"dependencies": {
"sweetalert2": "^7.17.0"
}
}
# command
$ yarn build
π€ Expected Behavior
build result must have no arrow function in because Iβm set target to IE 9 and IE 9 do not support arrow function.
π― Current Behavior
I can find arrow function easliy in build result.
π Possible Solution
use webpack (webpack@4 and babel@7)
π¦ Context
I tried to use babel-preset-env, babel-preset-latest, babel-plugin-es2015-arrow-function(blabla) but there is no effect.
π» Code Sample
import swal from 'sweetalert2';
(async () => {
await swal('hello');
})().then();
π Your Environment
| Software | Version(s) |
|---|---|
| Parcel | parcel-bundler@1.6.2 and 1.7.0 |
| Node | v9.7.1 |
| npm/Yarn | yarn 1.5.1 |
| Operating System | macOS 10.13.3 |
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 4
- Comments: 17 (6 by maintainers)
Commits related to this issue
- Remove jsnext:main The field is deprecated and replaced with package.module. Additionally it caused many issues with packages that used it incorrectly. Fixes #844, #1037, #1048, #1062. — committed to parcel-bundler/parcel by devongovett 6 years ago
- Remove jsnext:main The field is deprecated and replaced with package.module. Additionally it caused many issues with packages that used it incorrectly. Fixes #844, #1037, #1048, #1062. — committed to parcel-bundler/parcel by devongovett 6 years ago
- Remove jsnext:main The field is deprecated and replaced with package.module. Additionally it caused many issues with packages that used it incorrectly. Fixes #844, #1037, #1048, #1062. — committed to parcel-bundler/parcel by devongovett 6 years ago
If like me you came here trying to determine how to transpile linked packages in a lerna monorepo, let me save you some time clicking links.
The PR which added this feature is here.
The linked repository will need to have a
sourceproperty defined in itspackage.jsonfile. It will also need to have its own.babelrcfile if you are using any babel transpiled language features in that package.3.When compiling from source, alias specific files
I got it. I will make issue to sweetalert2.