UnhandledPromiseRejectionWarning: Error: Cyclic dependency

>npm run build:sit

> vue-element-admin@3.9.2 build:sit D:\work\workspace\code\ssp-front
> cross-env NODE_ENV=production env_config=sit node build/build.js

| building for sit environment...(node:5264) UnhandledPromiseRejectionWarning: Error: Cyclic dependency
    at visit (D:\work\workspace\code\ssp-front\node_modules\toposort\index.js:35:13)
    at visit (D:\work\workspace\code\ssp-front\node_modules\toposort\index.js:53:9)
    at visit (D:\work\workspace\code\ssp-front\node_modules\toposort\index.js:53:9)
    at Function.toposort [as array] (D:\work\workspace\code\ssp-front\node_modules\toposort\index.js:22:22)
    at Object.module.exports.dependency (D:\work\workspace\code\ssp-front\node_modules\html-webpack-plugin\lib\chunksorter.js:50:35)
    at HtmlWebpackPlugin.sortChunks (D:\work\workspace\code\ssp-front\node_modules\html-webpack-plugin\index.js:364:35)
    at D:\work\workspace\code\ssp-front\node_modules\html-webpack-plugin\index.js:113:21
    at AsyncSeriesHook.eval [as callAsync] (eval at create (D:\work\workspace\code\ssp-front\node_modules\tapable\lib\HookCodeFactory.js:32:10), <anonymous>:7:1)
    at AsyncSeriesHook.lazyCompileHook (D:\work\workspace\code\ssp-front\node_modules\tapable\lib\Hook.js:154:20)
    at Compiler.emitAssets (D:\work\workspace\code\ssp-front\node_modules\webpack\lib\Compiler.js:364:19)
    at onCompiled (D:\work\workspace\code\ssp-front\node_modules\webpack\lib\Compiler.js:231:9)
    at hooks.afterCompile.callAsync.err (D:\work\workspace\code\ssp-front\node_modules\webpack\lib\Compiler.js:553:14)
    at AsyncSeriesHook.eval [as callAsync] (eval at create (D:\work\workspace\code\ssp-front\node_modules\tapable\lib\HookCodeFactory.js:32:10), <anonymous>:6:1)
    at AsyncSeriesHook.lazyCompileHook (D:\work\workspace\code\ssp-front\node_modules\tapable\lib\Hook.js:154:20)
    at compilation.seal.err (D:\work\workspace\code\ssp-front\node_modules\webpack\lib\Compiler.js:550:30)
    at AsyncSeriesHook.eval [as callAsync] (eval at create (D:\work\workspace\code\ssp-front\node_modules\tapable\lib\HookCodeFactory.js:32:10), <anonymous>:6:1)
(node:5264) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:5264) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
- building for sit environment...

解决方案:

在HtmlWebpackPlugin中添加入

chunksSortMode: 'none',

结果如下:

 new HtmlWebpackPlugin({
            filename: 'index.html',
            template: 'index.html',
            inject: true,
            favicon: resolve('favicon.ico'),
            chunksSortMode: 'none',
            templateParameters: {
                BASE_URL: config.dev.assetsPublicPath + config.dev.assetsSubDirectory,
            },
        }),

 

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值