I’m trying to include a module from node.js in a .js
file, and I can’t do that with import
because it throws an error. I’m trying to do that with require
, but Glitch keeps giving me a require is not defined
error for some reason.
I tried changing the file extension to .cjs
, but Glitch gives me an error about mime types or whatever.
I don’t know what to do here.
Also, when I look at the Glitch starter for node.js, Glitch seems to think nothing is wrong, even when the file extension is .js
. So why am I getting this error and not the Glitch starter, even though we have the exact same file terminations?