Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incompatible with React 16 (crashes at runtime) #82

Open
Jessidhia opened this issue Sep 27, 2017 · 7 comments
Open

Incompatible with React 16 (crashes at runtime) #82

Jessidhia opened this issue Sep 27, 2017 · 7 comments

Comments

@Jessidhia
Copy link

Jessidhia commented Sep 27, 2017

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'
                }]
              }
            }
          ]
        }
      ]
    }
  }
)
@rudovjan
Copy link

Any plan with this?

@balmma
Copy link

balmma commented Oct 2, 2017

Or one can use Dominis13/react-tinymce directly from github until this package gets updated:
...
"react-tinymce": "git+ss://git@github.com:Dominis13/react-tinymce.git",
...

Probably a bit less cumbersome than the webpack config workaround.

@tknuts
Copy link

tknuts commented Oct 13, 2017

Having problem deploying the version: Dominis13/react-tinymc UglifyJs complaints on the line: let count = 0;
Any timeline for an official release?

@rockia
Copy link

rockia commented Oct 13, 2017

@tknuts I had the same issue, then I forked Dominis13's repo and fixed the entry point.
Maybe you can use my repo and give it a try https://github.com/rockia/react-tinymce . I also submitted a PR to Dominis13 . Hopefully this workaround works before this official repo got updated.

@balmma
Copy link

balmma commented Oct 16, 2017

Oh, I also had to change my require to require "react-tinymce/dist/react-tinymce.js".

But yes, changing the entry point is an even cleaner solution.

@tknuts
Copy link

tknuts commented Oct 16, 2017

@rockia Your version did the job for me :-) Thanks... will use it until the original one gets up to speed on React 16 👍

@grahamb
Copy link

grahamb commented Oct 18, 2017

0.7.0 was just published, which should resolve this issue (it's working fine for me with React 16).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants