Skip to content

Incompatible with React 16 (crashes at runtime) #82

Description

@Jessidhia

Related: #60 #61 #71 #72 #77

React.PropTypes should be replaced by import PropTypes from 'prop-types', and React.createClass by import createClass from 'create-react-class'.

In case anyone is blocked on this preventing upgrading to React 16, the following webpack config snippet can hack a workaround:

(
  {
    module: {
      rules: [
        {
          // react-tinymce uses APIs removed from React core, rewrite accesses to them
          // with accesses to the modules that provide those APIs
          test: /react-tinymce\/lib\/components\/TinyMCE.js$/,
          enforce: 'pre',
          use: [
            {
              loader: 'imports-loader',
              options: {
                '__import_PropTypes': 'prop-types',
                '__import_createClass': 'create-react-class'
              }
            },
            {
              loader: 'string-replace-loader',
              options: {
                multiple: [{
                  search: String.raw`_react2\['default'\].PropTypes`,
                  replace: '__import_PropTypes',
                  flags: 'g'
                }, {
                  search: String.raw`_react2\['default'\].createClass`,
                  replace: '__import_createClass',
                  flags: 'g'
                }]
              }
            }
          ]
        }
      ]
    }
  }
)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions