How to debug core-js polyfills? #9761
Replies: 3 comments
-
PS: I tried reproducing it in this parcel REPL but I am not sure how to specify browsersupport there granularly |
Beta Was this translation helpful? Give feedback.
-
I think I have a repro.
// index.ts
import "core-js/stable/structured-clone";
const p = structuredClone({});
console.log(p) Then build and look at the output npx parcel build index.ts --no-optimize
cat dist/index.js The output then looks like this
No structuredClone polyfill visible even though it would be needed for Safari 15.3 according to can-i-use |
Beta Was this translation helpful? Give feedback.
-
For comparison: this SWC playground seems to include the But only if the Could that be the reason? |
Beta Was this translation helpful? Give feedback.
-
From our error tracking I can see that some users with older browsers aren't getting the polyfills that they need to.
I wanted to look into whether core-js correctly expands imports how it should.
Here's what I checked so far.
npm ls core-js
-> version 3.34.0npx browserslist
-> Safari 15.3 is listed as supported by our .browserlistrcindex.tsx
imports -> we importimport "core-js"
according to the core-js docs this should expand to all the core-js features which need to be polyfilled in the given browsersmode: entry
for core-js (code)Is there any way to check this well? Specifically I am trying to find out why
structuredClone
was not polyfilled for Safari 15.3 even though I believe it should have been polyfilled given the configuration supplied above.It would be helpful to see how for example
So maybe like the output of the JS transformer without additional bundling or so
(Using parcel 2.12, with Node 20 on a Manjaro Linux Machine)
EDIT:
I believe it is related to how the
coreJs
option is or isn't passed to swc. More info belowBeta Was this translation helpful? Give feedback.
All reactions