You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Update README with create-react-app and YAML help (#8188)
I ran into some trouble using the code editor in my project. The main problems were that I had to do extra work that the docs didn't cover because I bootstrapped my project with `create-react-app` and I needed YAML highlighting support which required an extra plugin. This doc update should make it easier for anyone who's in the same boat :)
Copy file name to clipboardExpand all lines: packages/react-code-editor/README.md
+59Lines changed: 59 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -53,3 +53,62 @@ Install peer deps
53
53
```
54
54
55
55
To properly install the library `monaco-editor-webpack-plugin` be sure to follow the [plugin instructions](https://github.com/microsoft/monaco-editor/tree/main/webpack-plugin)
56
+
57
+
#### With create-react-app Projects
58
+
If you created your project with `create-react-app` you'll have some extra work to do, or you wont have syntax highlighting. Using the webpack plugin requires updating your webpack config, which `create-react-app` abstracts away. You can `npm eject` your project, but you may not want to do that. To keep your app set up in the `create-react-app` style but to get access to your webpack config you can use `react-app-rewired`.
59
+
60
+
First, install `react-app-rewired` as a development dependency:
61
+
```sh
62
+
$ npm install -D react-app-rewired
63
+
```
64
+
65
+
Next, replace all of the `react-script` references in your `package.json``scripts` section with `react-app-required`:
66
+
```json
67
+
"scripts": {
68
+
"start": "react-app-rewired start",
69
+
"build": "react-app-rewired build",
70
+
"test": "react-app-rewired test",
71
+
"eject": "react-app-rewired eject"
72
+
}
73
+
```
74
+
75
+
Next, create a `config-overries.js` file at the root of your project and add the following:
Note: You should change the `languages` array based on your needs.
89
+
90
+
You can now start your app with `npm start` and syntax highlighting should work.
91
+
92
+
#### Enable YAML Syntax Highlighting
93
+
The Monaco editor doesn't ship with full YAML support. You can configure your code editor with `Languages.yaml` but there will be no highlighting, even i you have the webpack plugin working correctly. To enable YAML support you need to do the following:
0 commit comments