UnhandledPromiseRejectionWarning: Error: Cyclic dependency

>npm run build:sit

> [email protected] 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), :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), :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), :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,
            },
        }),

 

你可能感兴趣的:(vue)