question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TypeError while doing server-rendering with minified version

See original GitHub issue

In the dist version of react-datepicker (minified) there is this:

return je.Utils=("undefined"!=typeof window?window:t).PopperUtils

which results in TypeError: Cannot read property 'PopperUtils' of undefined

Perhaps (and it fixes the problem) the minified version should also have global there instead of t, like this:

return je.Utils=("undefined"!=typeof window?window:global).PopperUtils

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:7

github_iconTop GitHub Comments

1reaction
Kronuzcommented, Oct 20, 2017

When using dist/react-datepicker.min.js, as it already comes packed and minified, the global variable somehow gets lost, producing an error: TypeError: Cannot read property 'PopperUtils' of undefined

To prevent this I’m directly using lib/datepicker.js instead.

You can either do import DatePicker from 'react-datepicker/lib/datepicker' or fork it and change package.json:

--- react-datepicker/package.json
+++ react-datepicker/package.json
@@ -5,7 +5,7 @@
   "version": "0.55.0",
   "license": "MIT",
   "homepage": "https://github.com/Hacker0x01/react-datepicker",
-  "main": "dist/react-datepicker.min.js",
+  "main": "lib/datepicker.js",
   "style": "dist/react-datepicker.min.css",
   "files": [
     "*.md",
0reactions
stale[bot]commented, Aug 30, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How can I find an error in the minified version of a script ...
If you go to that page, you'll see a Javascript error with an unhelpful message: TypeError: 'undefined' is not a function (near '...Animate(t, ......
Read more >
Use Any JavaScript Library With Vue.js
When the app runs on the server the window object will be undefined and so attempting to access a property will end with...
Read more >
Enable minify setting that time I got js errors on console
When we disable minify setting that time no error on console. We are using WordPress Version 5.6 and w3 cache Version 2.0.1. Any...
Read more >
ReactDOMServer
ReactDOMServer. The ReactDOMServer object enables you to render components to static markup. Typically, it's used on a Node server:.
Read more >
How to Minify JavaScript — Recommended Tools and ...
JavaScript title with a demo JavaScript code on a computer screen ... The minified version of JavaScript code can reduce the file size...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found