I'm making a weather app that implements an SQL database conection. I send the queries using the mysql npm module, I can't use require because node returns me
require is not defined in ES module scope
So i just import the module as here:
import mysql from 'mysql';
And it works fine in nodemon, but when I try to implement the whole app using xampp local server I get this error:
The requested module '/weatherapp/node_modules/mysql/index.js' does not provide an export named 'default
I've already tried using required in all the posible implementations (Using define, the [mysql], funtion() sintax ...) and it won't work.
I'm using a dbGestion.js file in which I try to import the mysql module and then defining functions and exporting them to main.js, where all the code for the app is.
You can checkout everything i have here: Proyect