Kaynağa Gözat

Merge pull request #48 from ckeditor/t/ckeditor5-dev/371

Other: Upgraded `webpack` to version 4.

BREAKING CHANGE: CKEditor 5 environment was updated to use `webpack@4`. `webpack@4` introduced major changes in its configuration and plugin system. CKEditor 5 tools and build configuration were updated to work with `webpack@4` now and will not work with `webpack@3.
Piotrek Koszuliński 7 yıl önce
ebeveyn
işleme
3ed672dd1a

+ 1 - 1
packages/ckeditor5-build-classic/bin/build-ckeditor.sh

@@ -3,7 +3,7 @@
 echo "Building 'build/ckeditor.js'..."
 echo ""
 
-webpack
+webpack --mode production
 
 echo ""
 echo "Done."

+ 7 - 7
packages/ckeditor5-build-classic/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",

+ 19 - 6
packages/ckeditor5-build-classic/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: {