ohmygod ohmygod - 2 months ago 22
Node.js Question

how to import external .js file in webpack with react?

Here is a file named tableau.js without npm package. I want to use it in my project? However, I cann't solve this problem. Please help me and show me correct ways. Thanks!

Answer Source

You need to use export module to export variables and functions from a file to another. Import your stuff to your main file. See https://www.sitepoint.com/understanding-module-exports-exports-node-js/

You could also use http://www.tutorialsteacher.com/nodejs/nodejs-module-exports