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
Parcel does not include polyfill for older browsers even when browserslist
is declared in the package.json
#7419
Comments
It looks like Does parcel provide a way for users to supply their own |
I am surprised as well since Parcel's documentation says |
|
Maybe that's why |
Actually, parcel passed
swc doc doesn't say what does
So you can install |
I also tried changing it to
EDIT: It builds, but throws runtime error. Look like it causes circular dependency in |
The reason that we don't use usage is that its detection of used language features isn't that accurate. So this should work:
|
Have stumbled into this issue. Does this mean, that the official doc is misleading? My use case "browserslist": [
"last 10 Chrome versions"
]
// introduced since Chrome 97
console.log(Array.prototype.findLast); Parcel will not include any polyfill into the output code. |
@mischnic unfortunately, it doesnt. import "core-js/actual";
console.log(Array.prototype.findLast); So, it clearly bundles the whole of When I do this - my bundle size is 55kb; here only the import "core-js/actual/array/find-last";
console.log(Array.prototype.findLast); |
@avalanche1 As far as I can tell, this is actually working mostly as expected. The core-js modules that are included is based on what is in your Interestingly, in my opinion 51 KB is quite big for targeting only Chrome 99. Upon investigation, it appears that This is the require hierarchy:
Though, since these are |
@mischnic The swc has evolved and the detection is now accurate (since 1.2.220). Does the parcel team have a plan to adopt it (and solve the issue)? |
1.2.220 was 17 days ago and https://github.com/swc-project/swc/blob/cdb9bbd707b776d43c4c885a98757be8d57914a4/crates/swc_ecmascript/Cargo.toml was 6 days ago, so #8390 might fix it then? Frankly I have no clue. |
Although the parcel would bump the swc, it still has to enable |
what's the best workaround for this? back to having babel but running parcel to pickup a {
"presets": [
[
"@parcel/babel-preset-env",
{
"targets": {
"chrome": "69"
},
"useBuiltIns": "usage",
"corejs": "3.6.9"
}
]
]
} |
@devongovett @mischnic, any updates on this? Maybe you should fix documentation (at least add link to this issue) https://parceljs.org/languages/javascript/#browser-compatibility
It doesn't working as expected, misleading and people waste time trying to setup parcel to work correctly |
Transpilation means syntax is compiled. It doesn't say anything about runtime polyfills. |
browserslist
is declared in the package.json
browserslist
is declared in the package.json
I have just updated the issue title to Also FYI, the swc has evolved and the |
Just a sidenote, but I think Parcel docs are at least a little bit misleading when it says this (in the Browser compatibility section):
Compare with Vite docs (also the Browser compatibility section) where you can find the info about polyfills straightaway:
Of course Parcel docs talk about transpilation only, but I'm not sure if many people make that connection. |
Maybe it has improved, but I don't believe it is possible for I think it's better to manually include polyfills either by importing |
Yeah, I totally agree with that. However, Babel's |
So what is the current recommended solution here? |
馃悰 bug report
RT.
馃帥 Configuration (.babelrc, package.json, cli command)
Reproduction: https://github.com/SukkaW/parcel-issue-7419/
馃 Expected Behavior
Parcel should include corresponding polyfills for cutting edge JavaScript features (like
WeakMap
,Set
andObject.fromEntries
) fromcore-js
, which is a dependency of@parcel/config-defaults
.SWC Playground
馃槸 Current Behavior
Parcel doesn't include any polyfill at all, even though
browserslist
is declared in thepackage.json
.馃拋 Possible Solution
Really?
swc
already handle this correctly. You guys just don't usecoreJs
andmode: usage
option by default? And you are telling me the parcel can be used withzero-configuration
?馃捇 Code Sample
https://github.com/SukkaW/parcel-issue-7419/
馃實 Your Environment
The text was updated successfully, but these errors were encountered: