[SOLVED] How can I solve react-select library issue with CDN | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 12

[SOLVED] How can I solve react-select library issue with CDN

I finished an exchange rate getter application. It works perfectly using node_modules. The problem is I cannot seem to grab the correct CDNs for one of the libraries. That library is called "react-select". Current version of react-select is "3.1.0". React-Select is a highly configurable dropdown library for React. The react-select project: https://react-select.com/home The site where i pick my CDNs is: https://www.cdnjs.com This is the page for react-select: https://cdnjs.com/libraries/react-select/3.1.0 The problem is I've already tried all of them and none of the combinations seem to work. The errors I get in the console are pretty obvious (example of 2 of them below): Uncaught ReferenceError: require is not defined at react-select.cjs.dev.min.js:1 Uncaught ReferenceError: exports is not defined at react-select.browser.cjs.min.js:1 I can't seem to understand why is it giving me this error since i import the scripts through the CDN, and i don't use the 'require' and 'export' keyw

21st May 2020, 9:24 PM
Sebastian Pacurar
Sebastian Pacurar - avatar
6 Answers
+ 5
Sebastian Pacurar The react-select is a npm package with common.js which is written for node.js execution. To make it run from browser, we have to bundle a new js file using browserify or webpack tools. The react-select requires many external libraries before it can run without error. To check for the dependency, you can run command "npm list", you would discover very long list of required library packages for this react-select.
22nd May 2020, 6:20 AM
Calviղ
Calviղ - avatar
+ 7
Calviղ, David Carroll, Burey, BENOTMANE i'm terribly sorry for disturbing you guys with something so small, but if you can have a quick look i would appreciate it beyond compare! if it cannot be done it's fine, i will start building a personal dropdown just to be able to run it in sololearn. thank you!
21st May 2020, 9:45 PM
Sebastian Pacurar
Sebastian Pacurar - avatar
+ 7
David Carroll sure thing 👍 take your time, no need to rush things! 😄
21st May 2020, 10:10 PM
Sebastian Pacurar
Sebastian Pacurar - avatar
+ 7
Calviղ Ok, i understood! thank you for your help and your time!
22nd May 2020, 9:42 AM
Sebastian Pacurar
Sebastian Pacurar - avatar
+ 5
Calviղ Thanks for answering this. Sebastian Pacurar I got caught up on a production issue and completely forgot to get back to this question. Sorry about that.
22nd May 2020, 2:54 PM
David Carroll
David Carroll - avatar
+ 3
Sebastian Pacurar No need to apologize. I'm always up for reviewing an interesting challenge. However, I may not be able to take a look until later tonight. About to go for a run and have dinner later. 😉
21st May 2020, 10:07 PM
David Carroll
David Carroll - avatar