Webpack 4.0.0 Õýʽ°æÒÑ·¢²¼£¬Webpack ÊÇÒ»¸öÏÖ´ú JavaScript Ó¦ÓóÌÐòµÄÄ£¿é´ò°üÆ÷ (module bundler) ¡£µ± Webpack ´¦ÀíÓ¦ÓóÌÐòʱ£¬Ëü»áµÝ¹éµØ¹¹½¨Ò»¸öÒÀÀµ¹Øϵͼ£¬ÆäÖаüº¬Ó¦ÓóÌÐòÐèÒªµÄÿ¸öÄ£¿é£¬È»ºó½«ËùÓÐÕâЩģ¿é´ò°ü³ÉÉÙÁ¿µÄ bundle - ͨ³£Ö»ÓÐÒ»¸ö£¬ÓÉä¯ÀÀÆ÷¼ÓÔØ¡£
ÕâÊÇÒ»¸ö´óµÄ¸üа汾£¬ÁÁµã°üÀ¨£º
Environment
²»ÔÙÖ§³Ö Node.js 4
Usage
ÏÖÔÚ¿ÉÒÔÔÚÁ½ÖÖģʽÖÐÑ¡Ôñ (mode or --mode) : Éú²úģʽ»ò¿ª·¢Ä£Ê½
Syntax
import() ×ÜÊÇ·µ»ØÒ»¸öÃüÃû¿Õ¼ä¶ÔÏó¡£CommonJS Ä£¿é±»·â×°µ½Ä¬Èϵ¼³öÖÐ
Configuration
NoEmitOnErrorsPlugin -> optimization.noEmitOnErrors (Éú²úģʽÏÂĬÈÏ¿ªÆô)
ModuleConcatenationPlugin -> optimization.concatenateModules (¿ª·¢Ä£Ê½ÏÂĬÈÏ¿ªÆô)
NamedModulesPlugin -> optimization.namedModules (¿ª·¢Ä£Ê½ÏÂĬÈÏ¿ªÆô)
ÒÔϲå¼þÒѲ»ÔÙÐèÒª:
CommonsChunkPlugin Òѱ»ÒƳý -> optimization.splitChunks, optimization.runtimeChunk
JSON
webpack ÏÖÔÚÄÜÔÉúµØ´¦Àí JSON
ÔÊÐíͨ¹ý ESM Óï·¨µ¼Èë JSON
Optimization
¸üРuglifyjs-webpack-plugin ÖÁ v1 °æ±¾£¬ÒÔÖ§³Ö ES15
Èí¼þÏêÇ飺https://github.com/webpack/webpack/releases/tag/v4.0.0
À´×Ô:¿ªÔ´ÖйúÉçÇø