ckeditor / ckeditor5-collaboration-samples

Collaboration integration examples for CKEditor 5
Other
51 stars 101 forks source link

Replace Uglify with Terser #22

Closed jswiderski closed 3 months ago

jswiderski commented 4 years ago

When building with  --mode production  you get UglifyJs Unexpected token: keyword (const) because Uglify doesn't support ES6 modules. We had this issue in CKEditor 5 thus we have switched our builds to Terser

We should probably do the same for collaboration samples.  For example, below lines:
https://github.com/ckeditor/ckeditor5-collaboration-samples/blob/master/track-changes-for-angular/vendor/ckeditor5/webpack.config.js#L33-L46
https://github.com/ckeditor/ckeditor5-collaboration-samples/blob/master/track-changes-for-angular/vendor/ckeditor5/package.json#L39

should be replaced with:

webpack.config.js

const TerserPlugin = require( 'terser-webpack-plugin' );
...
optimization: {
  minimizer: [
      new TerserPlugin( {
    sourceMap: true,
    terserOptions: {
        output: {
      // Preserve CKEditor 5 license comments.
      comments: /^!/
        }
    },
    extractComments: false
      } )
  ]
 },

package.json

"terser-webpack-plugin": "^2.2.1",

Link to Uglify - https://github.com/mishoo/UglifyJS/issues/3156#issuecomment-421509930. It seems no longer maintained.

f1ames commented 3 months ago

Since we migrated to new installation methods, and away from webpack, this is no longer relevant.