ckeditor4-react Error in Production Build

568 Views Asked by At

I'm using ckeditor 4-react version 1.4.0. This library is working fine when running as self hosted app (http://localhost:3000). But when I get production build with the npm run build command, it doesn't work properly. It gives the following error.

enter image description here

CKeditor component is here:

import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { withTranslation } from 'react-i18next';
import CKEditor from 'ckeditor4-react';
class RichTextEditor extends Component {
  constructor(props) {
    super(props);
    CKEditor.editorUrl = 'https://cdn.ckeditor.com/4.11.1/standard-all/ckeditor.js';
  }

  onEditorChange = (evt) => {
    const { onChange } = this.props;
    onChange(evt.editor.getData());
  }

  render() {
    const { value } = this.props;
    return (
      <CKEditor
        data={value}
        onChange={this.onEditorChange}
        config={{
          toolbar: [
            { name: 'basicstyles', items: ['Bold', 'Italic', 'Underline', 'Strike'] },
            { name: 'clipboard', items: ['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', '-', 'Undo', 'Redo'] },
            { name: 'insert', items: ['Link', 'Table'] },
            { name: 'styles', items: ['FontSize', 'Format'] },
            { name: 'paragraph', items: ['NumberedList', 'BulletedList', 'Blockquote', '-', 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'] }
          ],
          extraPlugins: 'font, justify, pastefromword, liststyle, pagebreak',
          removeButtons: '',
        }}
      />
    );
  }
}

export default (withTranslation('common')(RichTextEditor));
0

There are 0 best solutions below