{"id":21,"date":"2018-10-09T11:29:00","date_gmt":"2018-10-09T03:29:00","guid":{"rendered":"http:\/\/localhost\/qing\/wordpress\/?p=21"},"modified":"2018-10-09T11:32:39","modified_gmt":"2018-10-09T03:32:39","slug":"webpack-3-%e5%8d%87%e7%ba%a74%ef%bc%88%e4%b8%80%ef%bc%89","status":"publish","type":"post","link":"https:\/\/adeqing.com\/index.php\/2018\/10\/09\/default\/21\/","title":{"rendered":"webpack 3 \u5347\u7ea74\uff08\u4e00\uff09"},"content":{"rendered":"<h1 class=\"p1\">\u5347\u7ea7\u8fc7\u7a0b<\/h1>\n<h2 class=\"p2\"><strong>1.<span class=\"s1\">\u5347\u7ea7<\/span>webpack<\/strong><\/h2>\n<blockquote>\n<p class=\"p2\">npm i webpack@latest webpack-cli &#8211;save-dev<\/p>\n<\/blockquote>\n<p class=\"p2\">\u629b\u51fa\u5982\u4e0b\u9519\u8bef<\/p>\n<blockquote><p>shaoyundeMacBook-Pro:koc-marketing-site neal$ npm run dev-d-business<\/p>\n<p>&gt; koc-marketing-site@1.0.0 dev-d-business \/Users\/neal\/qwom\/KOC.Marketing\/koc-marketing-site<br \/>\n&gt; node bin\/run dev d-business<\/p>\n<p>(node:55308) DeprecationWarning: Tapable.plugin is deprecated. Use new API on `.hooks` instead<br \/>\n(node:55308) DeprecationWarning: Tapable.apply is deprecated. Call apply on the plugin directly instead<br \/>\n\u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510<br \/>\n\u2502 dev complete. \u2502<br \/>\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524<br \/>\n\u2502 stie [d-business] dev complete. server listening on 4002 \u2502<br \/>\n\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518<br \/>\n\/Users\/neal\/qwom\/KOC.Marketing\/koc-marketing-site\/node_modules\/_html-webpack-plugin@2.30.1@html-webpack-plugin\/lib\/compiler.js:81<br \/>\nvar outputName = compilation.mainTemplate.applyPluginsWaterfall(&#8216;asset-path&#8217;, outputOptions.filename, {<br \/>\n^<\/p>\n<p>TypeError: compilation.mainTemplate.applyPluginsWaterfall is not a function<br \/>\nat \/Users\/neal\/qwom\/KOC.Marketing\/koc-marketing-site\/node_modules\/_html-webpack-plugin@2.30.1@html-webpack-plugin\/lib\/compiler.js:81:51<br \/>\nat compile (\/Users\/neal\/qwom\/KOC.Marketing\/koc-marketing-site\/node_modules\/_webpack@4.20.2@webpack\/lib\/Compiler.js:290:11)<br \/>\nat hooks.afterCompile.callAsync.err (\/Users\/neal\/qwom\/KOC.Marketing\/koc-marketing-site\/node_modules\/_webpack@4.20.2@webpack\/lib\/Compiler.js:547:14)<br \/>\nat AsyncSeriesHook.eval [as callAsync] (eval at create (\/Users\/neal\/qwom\/KOC.Marketing\/koc-marketing-site\/node_modules\/_tapable@1.1.0@tapable\/lib\/HookCodeFactory.js:32:10), &lt;anonymous&gt;:6:1)<br \/>\nat AsyncSeriesHook.lazyCompileHook (\/Users\/neal\/qwom\/KOC.Marketing\/koc-marketing-site\/node_modules\/_tapable@1.1.0@tapable\/lib\/Hook.js:154:20)<br \/>\nat compilation.seal.err (\/Users\/neal\/qwom\/KOC.Marketing\/koc-marketing-site\/node_modules\/_webpack@4.20.2@webpack\/lib\/Compiler.js:544:30)<br \/>\nat AsyncSeriesHook.eval [as callAsync] (eval at create (\/Users\/neal\/qwom\/KOC.Marketing\/koc-marketing-site\/node_modules\/_tapable@1.1.0@tapable\/lib\/HookCodeFactory.js:32:10), &lt;anonymous&gt;:6:1)<br \/>\nat AsyncSeriesHook.lazyCompileHook (\/Users\/neal\/qwom\/KOC.Marketing\/koc-marketing-site\/node_modules\/_tapable@1.1.0@tapable\/lib\/Hook.js:154:20)<br \/>\nat hooks.optimizeAssets.callAsync.err (\/Users\/neal\/qwom\/KOC.Marketing\/koc-marketing-site\/node_modules\/_webpack@4.20.2@webpack\/lib\/Compilation.js:1296:35)<br \/>\nat AsyncSeriesHook.eval [as callAsync] (eval at create (\/Users\/neal\/qwom\/KOC.Marketing\/koc-marketing-site\/node_modules\/_tapable@1.1.0@tapable\/lib\/HookCodeFactory.js:32:10), &lt;anonymous&gt;:6:1)<br \/>\nat AsyncSeriesHook.lazyCompileHook (\/Users\/neal\/qwom\/KOC.Marketing\/koc-marketing-site\/node_modules\/_tapable@1.1.0@tapable\/lib\/Hook.js:154:20)<br \/>\nat hooks.optimizeChunkAssets.callAsync.err (\/Users\/neal\/qwom\/KOC.Marketing\/koc-marketing-site\/node_modules\/_webpack@4.20.2@webpack\/lib\/Compilation.js:1287:32)<br \/>\nat _err0 (eval at create (\/Users\/neal\/qwom\/KOC.Marketing\/koc-marketing-site\/node_modules\/_tapable@1.1.0@tapable\/lib\/HookCodeFactory.js:32:10), &lt;anonymous&gt;:11:1)<br \/>\nat \/Users\/neal\/qwom\/KOC.Marketing\/koc-marketing-site\/node_modules\/_uglifyjs-webpack-plugin@1.3.0@uglifyjs-webpack-plugin\/dist\/index.js:287:11<br \/>\nat Runner.runTasks (\/Users\/neal\/qwom\/KOC.Marketing\/koc-marketing-site\/node_modules\/_uglifyjs-webpack-plugin@1.3.0@uglifyjs-webpack-plugin\/dist\/uglify\/Runner.js:67:9)<br \/>\nat UglifyJsPlugin.optimizeFn (\/Users\/neal\/qwom\/KOC.Marketing\/koc-marketing-site\/node_modules\/_uglifyjs-webpack-plugin@1.3.0@uglifyjs-webpack-plugin\/dist\/index.js:198:16)<br \/>\nnpm ERR! code ELIFECYCLE<br \/>\nnpm ERR! errno 1<br \/>\nnpm ERR! koc-marketing-site@1.0.0 dev-d-business: `node bin\/run dev d-business`<br \/>\nnpm ERR! Exit status 1<br \/>\nnpm ERR!<br \/>\nnpm ERR! Failed at the koc-marketing-site@1.0.0 dev-d-business script.<br \/>\nnpm ERR! This is probably not a problem with npm. There is likely additional logging output above.<\/p>\n<p>npm ERR! A complete log of this run can be found in:<br \/>\nnpm ERR! \/Users\/neal\/.npm\/_logs\/2018-10-09T02_51_58_881Z-debug.log<\/p><\/blockquote>\n<p>\u89e3\u51b3\u529e\u6cd5<\/p>\n<blockquote><p>cnpm install extract-text-webpack-plugin@latest html-webpack-plugin@latest &#8211;save-dev<\/p><\/blockquote>\n<h2 class=\"p2\"><strong>2.\u629b\u51fa\u8b66\u544a<\/strong><\/h2>\n<blockquote><p>WARNING Compiled with 3 warnings 11:19:06<\/p>\n<p>warning<\/p>\n<p>configuration<br \/>\nThe &#8216;mode&#8217; option has not been set, webpack will fallback to &#8216;production&#8217; for this value. Set &#8216;mode&#8217; option to &#8216;development&#8217; or &#8216;production&#8217; to enable defaults for each environment.<br \/>\nYou can also set it to &#8216;none&#8217; to disable any default behavior. Learn more: https:\/\/webpack.js.org\/concepts\/mode\/<\/p>\n<p>warning<\/p>\n<p>asset size limit: The following asset(s) exceed the recommended size limit (244 KiB).<br \/>\nThis can impact web performance.<br \/>\nAssets:<br \/>\nstatic\/d-business\/img\/ionicons.a2c4a26.svg (542 KiB)<br \/>\njs\/index.js (6.49 MiB)<br \/>\njs\/vendors~index.lazy.index.js (707 KiB)<\/p>\n<p>warning<\/p>\n<p>entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (244 KiB). This can impact web performance.<br \/>\nEntrypoints:<br \/>\nindex (6.49 MiB)<br \/>\njs\/index.js<\/p><\/blockquote>\n<p>&nbsp;<\/p>\n<h5>\u4fee\u6539\u914d\u7f6e\u6587\u4ef6webpack.Dev.conf\u548cwebpack.prod.conf<\/h5>\n<h5>\u589e\u52a0mode\uff0c\u5220\u9664webpack.DefinePlugin<\/h5>\n<p>\u5220\u9664<\/p>\n<pre><del>devtool: configBuild.prod.productionSourceMap ? '#source-map' : false,<\/del>\r\n<del>plugins: [<\/del>\r\n<del>  \/\/ http:\/\/vuejs.github.io\/vue-loader\/en\/workflow\/production.html<\/del>\r\n<del>  new webpack.DefinePlugin({<\/del>\r\n<del>    'process.env': configBuild.prod.env<\/del>\r\n<del>  }),\r\n<\/del><\/pre>\n<p>\u589e\u52a0<\/p>\n<pre>devtool: configBuild.prod.productionSourceMap ? '#source-map' : false,\r\nmode: 'production',\r\nplugins: [\r\n  \/\/ http:\/\/vuejs.github.io\/vue-loader\/en\/workflow\/production.html\r\n  \/\/ new webpack.DefinePlugin({\r\n  \/\/   'process.env': configBuild.prod.env\r\n  \/\/ }),<\/pre>\n<p>\u53c2\u8003<\/p>\n<blockquote><p>https:\/\/juejin.im\/post\/5b0a6d366fb9a07aa213d16a#heading-1<\/p><\/blockquote>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5347\u7ea7\u8fc7\u7a0b 1.\u5347\u7ea7webpack npm i webpack@latest webpack-cli &#038;#821 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/adeqing.com\/index.php\/wp-json\/wp\/v2\/posts\/21"}],"collection":[{"href":"https:\/\/adeqing.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/adeqing.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/adeqing.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/adeqing.com\/index.php\/wp-json\/wp\/v2\/comments?post=21"}],"version-history":[{"count":6,"href":"https:\/\/adeqing.com\/index.php\/wp-json\/wp\/v2\/posts\/21\/revisions"}],"predecessor-version":[{"id":25,"href":"https:\/\/adeqing.com\/index.php\/wp-json\/wp\/v2\/posts\/21\/revisions\/25"}],"wp:attachment":[{"href":"https:\/\/adeqing.com\/index.php\/wp-json\/wp\/v2\/media?parent=21"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/adeqing.com\/index.php\/wp-json\/wp\/v2\/categories?post=21"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/adeqing.com\/index.php\/wp-json\/wp\/v2\/tags?post=21"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}