Skip to content

Commit 64e64c4

Browse files
committed
more explanation on peer-dependencies
1 parent c0907d3 commit 64e64c4

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

README.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,19 @@ import CodeMirror from 'react-codemirror2'
2727

2828
## requiring codemirror resources
2929

30+
- [codemirror](https://www.npmjs.com/package/codemirror)
31+
32+
`codemirror` comes as a [peer dependency](https://nodejs.org/en/blog/npm/peer-dependencies/), meaning you'll need to require it in your project _in addition to_ `react-codemirror2`. This prevents any versioning conflicts that would arise if `codemirror` came as a dependency through this wrapper. It's been observed that version mismatches can cause difficult to trace issues such as sytax highlighting disappearing without any explicit errors/warnings
33+
34+
- additional
35+
3036
Since codemirror ships mostly unconfigured, the user is left with the responsibility for requiring any additional resources should they be necessary. This is often the case when specifying certain [language modes]() and [themes](). How to import/require these assets will vary according to the specifics of your development environment. Below is a sample to include the assets necessary to specify a mode of `xml` (HTML) and a `material` theme.
3137

3238
> note that the base codemirror.css file is required in all use cases
3339
3440
```css
35-
@import '~/node_modules/codemirror/lib/codemirror.css';
36-
@import '~/node_modules/codemirror/theme/material.css';
41+
@import 'codemirror/lib/codemirror.css';
42+
@import 'codemirror/theme/material.css';
3743
```
3844

3945
```jsx

0 commit comments

Comments
 (0)