I know there are a lot of questions like this but i cannot find a good answer that explains this issue so i know to work around it in the future. Im trying to import codemirror into my electron app and both import statements and the require functions do not work.
import { EditorView, basicSetup } from "codemirror"
const { EditorView, basicSetup } = require("codemirror")
When I use the import statement I get an error that says
Uncaught TypeError: Failed to resolve module specifier "codemirror". Relative references must start with either "/", "./", or "../".
And then when I use require I get an error saying
Uncaught ReferenceError: require is not defined
All I would like is an explanation of why this is happening and ways to get around it. Thankyou.