Skip to content
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

flat is not function when run i android 9 #9635

Closed
shaodahong opened this issue Jun 20, 2024 · 9 comments
Closed

flat is not function when run i android 9 #9635

shaodahong opened this issue Jun 20, 2024 · 9 comments

Comments

@shaodahong
Copy link

Reproduction

official demo

System Info

android 9

Used Package Manager

npm

Expected Behavior

android 9 work fine

Actual Behavior

break in android 9

@shaodahong
Copy link
Author

and when i use @vitejs/plugin-legacy solve it, still not work

@brophdawg11
Copy link
Contributor

Please provide the specific error you're receiving and ideally a minimal reproduction

@brophdawg11 brophdawg11 added the needs-response We need a response from the original author about this issue/PR label Jun 20, 2024
@shaodahong
Copy link
Author

Please provide the specific error you're receiving and ideally a minimal reproduction

p.concat(...).map(...).flat is not a function Error message with Sentry , and when i search have many flat use

image

@github-actions github-actions bot removed the needs-response We need a response from the original author about this issue/PR label Jun 21, 2024
@brophdawg11
Copy link
Contributor

brophdawg11 commented Jun 24, 2024

Ah ok - you can fix this by polyfilling APIs you need - Array.prototype.flat has very good browser support so it's not something Remix would polyfill internally. I would recommend checking out core-js or https://polyfill.io/

⚠️ Scratch that - DO NOT USE polyfil.io - https://sansec.io/research/polyfill-supply-chain-attack

@brophdawg11 brophdawg11 closed this as not planned Won't fix, can't repro, duplicate, stale Jun 24, 2024
@shaodahong
Copy link
Author

shaodahong commented Jun 25, 2024

Ah ok - you can fix this by polyfilling APIs you need - Array.prototype.flat has very good browser support so it's not something Remix would polyfill internally. I would recommend checking out core-js or https://polyfill.io/

Thanks, finally, I manually imported core-js to solve it, but the problem is that each change becomes dangerous. Does remix plan to support the @vitejs/plugin-legacy plugin?

@brophdawg11
Copy link
Contributor

I'm not familiar with that plugin - can you not just add it to your vite config alongside the Remix plugin? If that doesn't work, I would open a new issue with a reproduction of that plugins incompatibility.

@brophdawg11
Copy link
Contributor

⚠️ Scratch that - DO NOT USE polyfil.io - https://sansec.io/research/polyfill-supply-chain-attack

@shaodahong
Copy link
Author

I'm not familiar with that plugin - can you not just add it to your vite config alongside the Remix plugin? If that doesn't work, I would open a new issue with a reproduction of that plugins incompatibility.

Yes, it doesn't work at all, and I create mini demo, you can see generate a polyfill asset when build, but html and manifest not include that

https://stackblitz.com/edit/remix-run-remix-ntmn6p?file=vite.config.ts

and thanks again for the heads up about the polyfill.io risk

@shaodahong
Copy link
Author

I'm not familiar with that plugin - can you not just add it to your vite config alongside the Remix plugin? If that doesn't work, I would open a new issue with a reproduction of that plugins incompatibility.

I spent a bit of time looking at @vitejs/plugin-legacy and it seems to do post-processing on the build target's html to make it compatible with older browsers, if there were a way to get that working it seems like the browser compatibility of remix would be incredibly strong

https://github.com/vitejs/vite/blob/3af02bde7e7f26889d5c0eb300219c43ed1293ad/packages/plugin-legacy/src/index.ts#L560

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants