I'm running a project by React, "@codingame/monaco-languageclient": "^0.17.3", "monaco-editor": "^0.31.1" and "react-monaco-editor": "^0.35.0". The compiling gave the following error:
Failed to compile.
./node_modules/vscode-languageclient/lib/common/client.js
Module not found: Can't resolve 'vscode' in '/Users/SoftTimur/10Studio/frontend/node_modules/vscode-languageclient/lib/common'
I found this thread, and there is indeed 'vscode': require.resolve('monaco-languageclient/lib/vscode-compatibility')
in webpack.config.js
of their example.
I then added 'vscode': require.resolve('@codingame/monaco-languageclient/lib/vscode-compatibility'),
to the alias
part of node_modules/react-scripts/config/webpack.config.js
. It did solve the error.
However, the problem is if I reinstall the project, I have to do this adding again. Does anyone know if there is an automatic way to inject 'vscode': require.resolve('@codingame/monaco-languageclient/lib/vscode-compatibility'),
to the alias
part of node_modules/react-scripts/config/webpack.config.js
?
PS: I'm using react-app-rewired already.