vue 使用webpack 打包 出現UnhandledPromiseRejectionWarning: Error: "dependency" is not a valid chunk sort mode at HtmlWebpackPlugin.sortEntryChunks


  具體錯誤如下

building for production...(node:12444) UnhandledPromiseRejectionWarning: Error: "dependency" is not a valid chunk sort mode
    at HtmlWebpackPlugin.sortEntryChunks (D:\Desktop\enn\venue\node_modules\html-webpack-plugin\index.js:488:11)
    at compiler.hooks.emit.tapAsync (D:\Desktop\enn\venue\node_modules\html-webpack-plugin\index.js:178:39)
    at AsyncSeriesHook.eval [as callAsync] (eval at create (D:\Desktop\enn\venue\node_modules\webpack\node_modules\tapable\lib\HookCodeFactory.js:32:10), <anonymou
s>:7:1)
    at AsyncSeriesHook.lazyCompileHook (D:\Desktop\enn\venue\node_modules\webpack\node_modules\tapable\lib\Hook.js:154:20)
    at Compiler.emitAssets (D:\Desktop\enn\venue\node_modules\webpack\lib\Compiler.js:363:19)
    at onCompiled (D:\Desktop\enn\venue\node_modules\webpack\lib\Compiler.js:231:9)
    at hooks.afterCompile.callAsync.err (D:\Desktop\enn\venue\node_modules\webpack\lib\Compiler.js:552:14)
    at AsyncSeriesHook.eval [as callAsync] (eval at create (D:\Desktop\enn\venue\node_modules\webpack\node_modules\tapable\lib\HookCodeFactory.js:32:10), <anonymou
s>:6:1)
    at AsyncSeriesHook.lazyCompileHook (D:\Desktop\enn\venue\node_modules\webpack\node_modules\tapable\lib\Hook.js:154:20)
    at compilation.seal.err (D:\Desktop\enn\venue\node_modules\webpack\lib\Compiler.js:549:30)
    at AsyncSeriesHook.eval [as callAsync] (eval at create (D:\Desktop\enn\venue\node_modules\webpack\node_modules\tapable\lib\HookCodeFactory.js:32:10), <anonymou
s>:6:1)
    at AsyncSeriesHook.lazyCompileHook (D:\Desktop\enn\venue\node_modules\webpack\node_modules\tapable\lib\Hook.js:154:20)
    at hooks.optimizeAssets.callAsync.err (D:\Desktop\enn\venue\node_modules\webpack\lib\Compilation.js:1323:35)
    at AsyncSeriesHook.eval [as callAsync] (eval at create (D:\Desktop\enn\venue\node_modules\webpack\node_modules\tapable\lib\HookCodeFactory.js:32:10), <anonymou
s>:6:1)
    at AsyncSeriesHook.lazyCompileHook (D:\Desktop\enn\venue\node_modules\webpack\node_modules\tapable\lib\Hook.js:154:20)
    at hooks.optimizeChunkAssets.callAsync.err (D:\Desktop\enn\venue\node_modules\webpack\lib\Compilation.js:1314:32)
(node:12444) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch bl
ock, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:12444) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the N
ode.js process with a non-zero exit code.

 

這個選項決定了 script 標簽的引用順序。默認有四個選項,'none', 'auto', 'dependency', '{function}'。

  • 'dependency'  按照不同文件的依賴關系來排序。

  • 'auto' 默認值

  • 'none'  

  • {function}  不懂

       'dependency'  按照不同文件的依賴關系來排序  

 改為auto  注銷都可以

 

 

npm run build 

打包成功

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM