The code is logically correct, but parts of it may need to be reviewed or changed to ensure that all errors are corrected. A few points to check more closely:
Not calling a module or library without a valid value: In code, you EditorView(null); You called without a valid value, which produces an error. This command may give an error if the CodeMirror library is not loaded correctly. Make sure CodeMirror is downloaded from the correct source.
Library access: It looks like EditorView is in the CodeMirror library, and you used a GitHub link to download it. Note that GitHub does not allow direct upload of JavaScript files by default. For CodeMirror to work properly, make sure you download it from a source, either a CDN or a local installation.
Lack of await support in normal script: In one of the sections, you have used await without inside the async function. From await, you must enter an async script or async function.
Compatibility with different browsers: The different behavior you see in browsers can be due to differences in security and each browser. To fix this problem and ensure consistency, handle your errors in different ways.
In general, if you make a mistake or don't execute the code correctly, you can check any error seriously and use valid errors to see the actual error message instead of the generic message.