React-draft-wysiwyg: uglifyjs-webpack: TypeError: Super expression must either be null or a function, not undefined

Created on 1 Aug 2018  路  5Comments  路  Source: jpuri/react-draft-wysiwyg

Hello. Everything works fine in development, but when I change to production I got this:

Sortable.js:7 TypeError: Super expression must either be null or a function, not undefined
    at react-draft-wysiwyg.js:6
    at react-draft-wysiwyg.js:6
    at react-draft-wysiwyg.js:6
    at t.default (react-draft-wysiwyg.js:6)
    at t.getCompositeDecorator (react-draft-wysiwyg.js:6)
    at t.value (react-draft-wysiwyg.js:6)
    at aa (react-dom.production.min.js:13)
    at react-dom.production.min.js:13
    at si (react-dom.production.min.js:13)
    at ui (react-dom.production.min.js:13)

In production I use uglifyjs-webpack-plugin and that's the cause of the error and I don't really know why.

Most helpful comment

I solved a similar issue by changing the uglify plugin's settings in the webpack config to not change fnames:

optimization:{
  minimizer: [new UglifyJsPlugin({
      uglifyOptions: {
        compress: {
          inline: 1,
          keep_fnames: true
        },
        mangle: {
          keep_fnames: true
        }
      }
    })]
}

All 5 comments

I get the same error...

I also get this error.

I solved it by using babel-minify-webpack-plugin instead of uglifyjs-webpack

I solved a similar issue by changing the uglify plugin's settings in the webpack config to not change fnames:

optimization:{
  minimizer: [new UglifyJsPlugin({
      uglifyOptions: {
        compress: {
          inline: 1,
          keep_fnames: true
        },
        mangle: {
          keep_fnames: true
        }
      }
    })]
}

What worked for me here was to set the inline option for the compress option to false because by default it is true for the uglifyOptions.

optimization:{
  minimizer: [new UglifyJsPlugin({
      uglifyOptions: {
        compress: {
          inline: 1, // this right here
          // keep_fnames: true
        },
        mangle: {
          // keep_fnames: true
        }
      }
    })]
}
Was this page helpful?
0 / 5 - 0 ratings

Related issues

rajasekar-ideas2it picture rajasekar-ideas2it  路  4Comments

MaDejing picture MaDejing  路  3Comments

DiegoGallegos4 picture DiegoGallegos4  路  4Comments

FriOne picture FriOne  路  3Comments

Leadrive picture Leadrive  路  3Comments