I am trying to use react-summernote for our project, but cannot even run the simple sample follow README and some related issues. Below is my code and error content. Does anyone have any idea?
Thanks for your support.
- Installed steps:
- Usage
- RickTextEditor.jsx(define)
`import React, { Component } from 'react';
import $ from 'jquery';
window.$ = $;
window.jQuery = $;
import ReactSummernote from 'react-summernote';
import 'react-summernote/dist/react-summernote.css'; // import styles
import 'react-summernote/lang/summernote-ja-JP'; // you can import any other locale
// Import bootstrap(v3 or v4) dependencies
import 'bootstrap/js/modal';
import 'bootstrap/js/dropdown';
import 'bootstrap/js/tooltip';
import 'bootstrap/dist/css/bootstrap.css';
export class RichTextEditor extends Component {
onChange(content) {
console.log('onChange', content);
}
render() {
return (
<ReactSummernote
value="Default value"
options={{
lang: 'ja-JP',
height: 350,
dialogsInBody: true,
toolbar: [
['style', ['style']],
['font', ['bold', 'underline', 'clear']],
['fontname', ['fontname']],
['para', ['ul', 'ol', 'paragraph']],
['table', ['table']],
['insert', ['link', 'picture', 'video']],
['view', ['fullscreen', 'codeview']],
],
}}
onChange={this.onChange}
/>
);
}
}`
-
webpack.config.js (config)
plugins: [ new webpack.DefinePlugin({ $: 'jquery', jQuery: 'jquery', }) ]
-
XXX.jsx(usage)
import { RichTextEditor } from '../../../RichTextEditor'; ............................................. <RichTextEditor />
-
Error content (on browser)
jquery.js:10253 Uncaught Error: Module parse failed: Unexpected character '�' (1:0) You may need an appropriate loader to handle this file type. (Source code omitted for this binary file) at Object.<anonymous> (jquery.js:10253) at __webpack_require__ (bootstrap dddf0cbf45eda11341aa:19) at Object.$.extend.ja-JP.font.bold (react-summernote.css:6) at __webpack_require__ (bootstrap dddf0cbf45eda11341aa:19) at Object.<anonymous> (react-summernote.css?d852:4) at __webpack_require__ (bootstrap dddf0cbf45eda11341aa:19) at Object.<anonymous> (RichTextEditor.jsx:8) at __webpack_require__ (bootstrap dddf0cbf45eda11341aa:19) at Object.defineProperty.value (Detail.jsx:16) at __webpack_require__ (bootstrap dddf0cbf45eda11341aa:19) at Object.defineProperty.value (New.jsx:4) at __webpack_require__ (bootstrap dddf0cbf45eda11341aa:19) at Object.defineProperty.value (Items.jsx:5) at __webpack_require__ (bootstrap dddf0cbf45eda11341aa:19) at Object.defineProperty.value (Maker.jsx:4) at __webpack_require__ (bootstrap dddf0cbf45eda11341aa:19)
- Error content (on terminal)
`ERROR in ./node_modules/react-summernote/dist/summernote.ttf
Module parse failed: Unexpected character '' (1:0)
You may need an appropriate loader to handle this file type.
(Source code omitted for this binary file)
@ ./node_modules/css-loader!./node_modules/react-summernote/dist/react-summernote.css 6:295-322
@ ./node_modules/react-summernote/dist/react-summernote.css
@ ./react/src/containers/maker/common/RichTextEditor.jsx
@ ./react/src/components/maker/items/Detail.jsx
@ ./react/src/containers/maker/items/New.jsx
@ ./react/src/routes/maker/Items.jsx
@ ./react/src/routes/maker/Maker.jsx
@ ./react/src/routes/Main.jsx
@ ./react/src/containers/App.jsx
@ ./react/src/index.jsx
ERROR in ./node_modules/bootstrap/dist/fonts/glyphicons-halflings-regular.ttf
Module parse failed: Unexpected character '' (1:0)
You may need an appropriate loader to handle this file type.
(Source code omitted for this binary file)
@ ./node_modules/css-loader!./node_modules/bootstrap/dist/css/bootstrap.css 6:4790-4842
@ ./node_modules/bootstrap/dist/css/bootstrap.css
@ ./react/src/containers/maker/common/RichTextEditor.jsx
@ ./react/src/components/maker/items/Detail.jsx
@ ./react/src/containers/maker/items/New.jsx
@ ./react/src/routes/maker/Items.jsx
@ ./react/src/routes/maker/Maker.jsx
@ ./react/src/routes/Main.jsx
@ ./react/src/containers/App.jsx
@ ./react/src/index.jsx
ERROR in ./node_modules/react-summernote/dist/summernote.woff
Module parse failed: Unexpected character '' (1:4)
You may need an appropriate loader to handle this file type.
(Source code omitted for this binary file)
@ ./node_modules/css-loader!./node_modules/react-summernote/dist/react-summernote.css 6:236-264
@ ./node_modules/react-summernote/dist/react-summernote.css
@ ./react/src/containers/maker/common/RichTextEditor.jsx
@ ./react/src/components/maker/items/Detail.jsx
@ ./react/src/containers/maker/items/New.jsx
@ ./react/src/routes/maker/Items.jsx
@ ./react/src/routes/maker/Maker.jsx
@ ./react/src/routes/Main.jsx
@ ./react/src/containers/App.jsx
@ ./react/src/index.jsx
ERROR in ./node_modules/bootstrap/dist/fonts/glyphicons-halflings-regular.woff2
Module parse failed: Unexpected character '' (1:4)
You may need an appropriate loader to handle this file type.
(Source code omitted for this binary file)
@ ./node_modules/css-loader!./node_modules/bootstrap/dist/css/bootstrap.css 6:4622-4676
@ ./node_modules/bootstrap/dist/css/bootstrap.css
@ ./react/src/containers/maker/common/RichTextEditor.jsx
@ ./react/src/components/maker/items/Detail.jsx
@ ./react/src/containers/maker/items/New.jsx
@ ./react/src/routes/maker/Items.jsx
@ ./react/src/routes/maker/Maker.jsx
@ ./react/src/routes/Main.jsx
@ ./react/src/containers/App.jsx
@ ./react/src/index.jsx
ERROR in ./node_modules/bootstrap/dist/fonts/glyphicons-halflings-regular.woff
Module parse failed: Unexpected character '' (1:4)
You may need an appropriate loader to handle this file type.
(Source code omitted for this binary file)
@ ./node_modules/css-loader!./node_modules/bootstrap/dist/css/bootstrap.css 6:4707-4760
@ ./node_modules/bootstrap/dist/css/bootstrap.css
@ ./react/src/containers/maker/common/RichTextEditor.jsx
@ ./react/src/components/maker/items/Detail.jsx
@ ./react/src/containers/maker/items/New.jsx
@ ./react/src/routes/maker/Items.jsx
@ ./react/src/routes/maker/Maker.jsx
@ ./react/src/routes/Main.jsx
@ ./react/src/containers/App.jsx
@ ./react/src/index.jsx
ERROR in ./node_modules/react-summernote/dist/summernote.eot
Module parse failed: Unexpected character '' (1:0)
You may need an appropriate loader to handle this file type.
(Source code omitted for this binary file)
@ ./node_modules/css-loader!./node_modules/react-summernote/dist/react-summernote.css 6:113-140 6:158-185
@ ./node_modules/react-summernote/dist/react-summernote.css
@ ./react/src/containers/maker/common/RichTextEditor.jsx
@ ./react/src/components/maker/items/Detail.jsx
@ ./react/src/containers/maker/items/New.jsx
@ ./react/src/routes/maker/Items.jsx
@ ./react/src/routes/maker/Maker.jsx
@ ./react/src/routes/Main.jsx
@ ./react/src/containers/App.jsx
@ ./react/src/index.jsx
ERROR in ./node_modules/bootstrap/dist/fonts/glyphicons-halflings-regular.eot
Module parse failed: Unexpected character '�' (1:0)
You may need an appropriate loader to handle this file type.
(Source code omitted for this binary file)
@ ./node_modules/css-loader!./node_modules/bootstrap/dist/css/bootstrap.css 6:4445-4497 6:4520-4572
@ ./node_modules/bootstrap/dist/css/bootstrap.css
@ ./react/src/containers/maker/common/RichTextEditor.jsx
@ ./react/src/components/maker/items/Detail.jsx
@ ./react/src/containers/maker/items/New.jsx
@ ./react/src/routes/maker/Items.jsx
@ ./react/src/routes/maker/Maker.jsx
@ ./react/src/routes/Main.jsx
@ ./react/src/containers/App.jsx
@ ./react/src/index.jsx
ERROR in ./node_modules/bootstrap/dist/fonts/glyphicons-halflings-regular.svg
Module parse failed: Unexpected token (1:0)
You may need an appropriate loader to handle this file type.
|
|
|
@ ./node_modules/css-loader!./node_modules/bootstrap/dist/css/bootstrap.css 6:4876-4928
@ ./node_modules/bootstrap/dist/css/bootstrap.css
@ ./react/src/containers/maker/common/RichTextEditor.jsx
@ ./react/src/components/maker/items/Detail.jsx
@ ./react/src/containers/maker/items/New.jsx
@ ./react/src/routes/maker/Items.jsx
@ ./react/src/routes/maker/Maker.jsx
@ ./react/src/routes/Main.jsx
@ ./react/src/containers/App.jsx
@ ./react/src/index.jsx`