-
-
Notifications
You must be signed in to change notification settings - Fork 890
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
TypeError: key.split(...).at is not a function #1465
Comments
When rolling back to 5.7.0, I saw the issue was resolved, if that helps. |
can't fix in vite application,sad |
@berrytsukiii You should be able to get older versions working with Vite by following manual configuration process. I don't recommend that however, because I have almost no capacity to provide support for the latest version, let alone legacy ones. |
@wojtekmaj thks and according to this comment #1220 (comment) ,i have solved it temporarily。 |
It happens on Safari v14.1.2 too (we don't use Vite) EnvironmentBrowser (if applicable): Safari v14.1.2, v15 |
install corejs and add this: import 'core-js/features/array/at'; |
@chongqiangchen still the same error continues... |
let me see how you write ? |
I write similarly to you, but I don't seem to have encountered your problem. My component: https://github.com/chongqiangchen/unowai-frontend/blob/main/src/ui/widgets/pdf/index.tsx Where I import the core: https://github.com/chongqiangchen/unowai-frontend/blob/main/src/pages/_app.tsx |
Error resolved after adding import 'core-js/features/array/at' at _app.js Thanks for helping me out.... |
I have the same issue and importing the core-js 'at' array helper to App.tsx didn't help. Perhaps the 'at' helper should be removed? It seems a bit too new to be used in production yet. It's only supported in modern browsers at this stage. |
I'm not using it, PDF.js dependency is using it. There is an understandable push from the community to keep PDF.js up to date, but they also cut off from older browsers (2+ yrs) on a regular basis. I have updated instructions in README yesterday and suggested using legacy worker if needed. Let me know if this works! |
@asif-simform Did you import 'core-js/features/array/at' as advised? |
Since the documentation was updated to mention necessary polyfills and "base" compatibility table has been fixed I consider this issue resolved. If the documentation doesn't mention anything else it could, let me know. |
@asif-simform There's not a lot I can tell from this screenshot other than that Array.prototype.at is still undefined so either you're doing something incorrectly (e.g. loading core-js AFTER react-pdf) or perhaps some other tool is messing around with core-js imports. I used core-js Array.prototype.at polyfill at the demo site and I got it working with Safari 15.2 just fine. |
Just a heads up that this error also comes up from PDF.js itself now (rather than just the worker), so adding the polyfill is the only real solution. The core-js fix is working fine for me, it just needs to be imported before |
Before you start - checklist
Description
Building into nextjs project here.
After running
npm i react-pdf -P
, and attemptingnpm run build
, I experience the error in the title. Is there a previous version I should roll back to?Steps to reproduce
install, build with nextjs
Expected behavior
expect a successful build
Actual behavior
Additional information
No response
Environment
The text was updated successfully, but these errors were encountered: