This is happening in a react project using webpack. The project is created using create-react-app
After a lot of debugging, I have found the cause of the error to be in the following file.
It happens in the function below:
function getEditorMetadata(monacoEditorPath: string | undefined): EditorMetadata {
const metadataPath = resolveMonacoPath('metadata.js', monacoEditorPath);
return require(metadataPath);
}
Line no: 58
But I'm not sure from where that file should come from. I have googled it but seems like there are no traces of this error to be found.
Appreciate your help on this.
Finally, I was able to solve the issue. Firstly, I commented
new MonacoEditorWebpackPlugin()in the webpack config plugins.Then, the issue I got was that there was a module missing -
monaco-editorThough, I was already using -
@monaco-editor/reactBut I installed,
monaco-editorand then it worked.