diff --git a/bin/build-ckeditor.sh b/bin/build-ckeditor.sh index 492e932f31..d795a2784f 100755 --- a/bin/build-ckeditor.sh +++ b/bin/build-ckeditor.sh @@ -3,7 +3,7 @@ echo "Building 'build/ckeditor.js'..." echo "" -webpack +webpack --mode production echo "" echo "Done." diff --git a/package.json b/package.json index e38dd9ba21..296a97f5f8 100644 --- a/package.json +++ b/package.json @@ -33,8 +33,8 @@ "@ckeditor/ckeditor5-autoformat": "^10.0.1", "@ckeditor/ckeditor5-basic-styles": "^10.0.1", "@ckeditor/ckeditor5-block-quote": "^10.0.1", - "@ckeditor/ckeditor5-dev-utils": "^9.0.0", - "@ckeditor/ckeditor5-dev-webpack-plugin": "^5.0.0", + "@ckeditor/ckeditor5-dev-utils": "^10.0.0", + "@ckeditor/ckeditor5-dev-webpack-plugin": "^6.0.0", "@ckeditor/ckeditor5-easy-image": "^10.0.1", "@ckeditor/ckeditor5-editor-classic": "^10.0.1", "@ckeditor/ckeditor5-essentials": "^10.1.0", @@ -45,12 +45,12 @@ "@ckeditor/ckeditor5-paragraph": "^10.0.1", "@ckeditor/ckeditor5-theme-lark": "^10.1.0", "@ckeditor/ckeditor5-upload": "^10.0.1", - "babel-minify-webpack-plugin": "^0.3.0", - "postcss-loader": "^2.0.10", + "postcss-loader": "^2.1.5", "raw-loader": "^0.5.1", - "style-loader": "^0.20.3", - "webpack": "^3.11.0", - "webpack-sources": "1.0.1" + "style-loader": "^0.21.0", + "uglifyjs-webpack-plugin": "^1.2.7", + "webpack": "^4.15.0", + "webpack-cli": "^3.0.8" }, "engines": { "node": ">=6.0.0", diff --git a/webpack.config.js b/webpack.config.js index 640716d20c..84108480da 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -11,11 +11,12 @@ const path = require( 'path' ); const webpack = require( 'webpack' ); const { bundler, styles } = require( '@ckeditor/ckeditor5-dev-utils' ); const CKEditorWebpackPlugin = require( '@ckeditor/ckeditor5-dev-webpack-plugin' ); -const BabiliPlugin = require( 'babel-minify-webpack-plugin' ); +const UglifyJsWebpackPlugin = require( 'uglifyjs-webpack-plugin' ); const buildConfig = require( './build-config' ); module.exports = { devtool: 'source-map', + performance: { hints: false }, entry: path.resolve( __dirname, 'src', 'ckeditor.js' ), @@ -27,19 +28,31 @@ module.exports = { library: buildConfig.moduleName }, + optimization: { + minimizer: [ + // Use the newest version of UglifyJsWebpackPlugin that fixes the `inline` optimization bug. + // See https://github.com/webpack-contrib/uglifyjs-webpack-plugin/issues/264. + new UglifyJsWebpackPlugin( { + sourceMap: true, + uglifyOptions: { + output: { + // Preserve CKEditor 5 license comments. + comments: /^!/ + } + } + } ) + ] + }, + plugins: [ new CKEditorWebpackPlugin( { language: buildConfig.config.language, additionalLanguages: 'all' } ), - new BabiliPlugin( null, { - comments: false - } ), new webpack.BannerPlugin( { banner: bundler.getLicenseBanner(), raw: true - } ), - new webpack.optimize.ModuleConcatenationPlugin() + } ) ], module: {