react-monaco-editor: Error: cannot find 'monaco-editor'
I’ve been getting the this when I try to use this package (latest with monaco-editor v0.13.1):
Here’s my webpack build:
const path = require('path')
const webpack = require('webpack')
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const MonacoWebpackPlugin = require('monaco-editor-webpack-plugin');
module.exports = {
mode:'development',
devtool: 'source-map',
optimization: {
splitChunks:{}
},
entry: {
app: './ui/client/index.js'
},
context: path.resolve(__dirname),
output: {
path: path.join(__dirname, 'dist'),
filename: '[name].js',
publicPath: '/dist/'
},
plugins: [
new ExtractTextPlugin('styles.css'),
new webpack.DefinePlugin({
"process.env": {
BROWSER: JSON.stringify(true)
}
}),
new MonacoWebpackPlugin()
],
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
include: path.resolve(__dirname),
use: {
loader: "babel-loader"
}
},
{
test: /\.css$/,
loader: ExtractTextPlugin.extract({ fallback: 'style-loader', use: 'css-loader' })
}
]
}
};
Any idea why? I’d appreaciate your response!
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 2
- Comments: 18 (1 by maintainers)
I ran into pretty much the same thing with jest in test using this module,
had to “alias”
monaco-editor
toreact-monaco-editor
to help jest resolve it:Hey @expobrain, sorry I should’ve included it initially. Here’s the full error:
@mattpardee I tried to use https://github.com/resourcesco/snippets/blob/master/docs/monaco-editor-with-next.md steps but it was not working well.
Here’s my experiment (pretty early though) with NextJs and Monaco https://morphism-playground.now.sh/ (A playground for https://github.com/nobrainr/morphism)
Here’s the code source: https://github.com/nobrainr/morphism-playground
Hope it helps, let me know!
I’m using @monaco-editor/react package and I followed the suggestion above comment by @sanusart . Thanks
This works for me:
I ran into the same issue too. 😦
I ran into the same issue. 😦