-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
🐛Parcel do not transpile some ES6+ code in node_modules #1037
Comments
{
// ...
"main": "dist/sweetalert2.all.js",
"jsnext:main": "src/sweetalert2.js",
// ...
} I think parcel uses |
Probably the problem is not in the arrow function. const double = n => n * 2 |
The problem here is that code in node_modules contains arrow functions (see my previous comment) and isn't getting transpiled. It works for "user" code. |
I just experienced a similar situation. One of my npm dependencies (jsesc) uses es6 syntax. The dependency is not transpiled according to my projectes |
I tested again in |
The problem is that parcel isn't using/choosing the transpiled dependency code (
|
This is the problem of the package. Jsnext main should specify esm transpired format, not source. Also it's deprecated in favor of module field. |
Quite a controversial topic:
|
I got it. I will make issue to sweetalert2. |
so currently I have a main app (parcel build src/index.js --target=node) and a node_module package (linked from part of monorepo) that includes ES6 code (eg import), I am not able to get parcel to transpile it despite having .babelrc. // index.js |
To effectively transpile ES6 modules in |
@bugzpodder I'm having the same problem. Are you able to resolve your issue? |
By switching to webpack 4. Newer releases of parcel might have resolved it? or just downgrade it to an old version for now? |
@rodoabad @bugzpodder This has been resolved a couple versions ago #1101 |
Oh dear lordy. OK. For some reason, |
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
{
"main": "foo.js",
"source": true
}
{
"main": "foo.js",
"source": "bar.js"
} 3.When compiling from source, alias specific files {
"main": "foo.js",
"source": {
"./foo.js": "./bar.js",
"./baz.js": "./yay.js"
}
}
{
"main": "foo.js",
"source": {
"./lib/**": "./src/$1"
}
} |
Feel free to contribute to the docs, to save people the search as well @hansoksendahl https://github.com/parcel-bundler/website |
Choose one: is this a 🐛 bug report or 🙋 feature request?
🐛bug
🎛 Configuration (.babelrc, package.json, cli command)
# 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
🌍 Your Environment
The text was updated successfully, but these errors were encountered: