Hello everyone! Question about imports. I need to implement class export so that I can require access classes that are described in neighboring files. I settled on the CommonJS method because I don’t want to use the bundler.
What’s the problem?
I created a Db.js file. I described the constructor, methods, and added this class to module.exports. Then, in the Server.js file, I try to do require(’ ./Db.js’ ), but I get the error “Error loading script Server/Server.js in resource tw: Error: Cannot find module './Db.js” . The Db.js file is added to server_scripts.
Why is this happening? Both files are in the same folder. I don’t see any problems, why this doesn’t work. Do I really have to use ES6 and the bundler?