gpt4 book ai didi

vue.js - 抛出新错误 ('Cyclic dependency' + nodeRep)

转载 作者:搜寻专家 更新时间:2023-10-30 22:28:21 28 4
gpt4 key购买 nike

我在我的应用程序中使用了很多图表,我想尽可能地处理 vuex 存储中的所有图表颜色。我使用下面的代码来实现这一点。

store.js

import Vue from 'vue'
import Vuex from 'vuex'

// modules
import settings from './modules/settings';

Vue.use(Vuex);

export const store = new Vuex.Store({
modules: {
settings
}
})

chart-config.js

/**
* Change all chart colors
*/
import { store } from "../store/store";

const { primary, warning, error, info, success } = store.getters.chartColors;

export const ChartConfig = {
color: {
'primary': primary,
'warning': warning,
'danger': error,
'success': success,
'info': info,
'white': '#fff',
'lightGrey': '#E8ECEE'
},
lineChartAxesColor: '#E9ECEF',
legendFontColor: '#AAAEB3', // only works on react chart js 2
chartGridColor: '#EAEAEA',
axesColor: '#657786',
shadowColor: 'rgba(0,0,0,0.3)'
}

文件夹结构:

src
-components
-constants
--chart-config.js
-store
--store.js
-views
App.vue
main.js

每当我尝试运行 npm run dev 命令时,我都会遇到这种类型的错误

95% emitting HtmlWebpackPlugin/media/iron/631dbce0-858c-4a8c-bef4- 
a01a6a92507f/shubham/work/dev/vue/myapp/node_modules/toposort/index.js:35
throw new Error('Cyclic dependency' + nodeRep)

最佳答案

更新 2018-07-31

几天前,我在使用 @vue/cli (Vue CLI 3) 创建的 vue 应用程序时遇到了同样的问题。但是they fixed it最近。

旧答案

我的解决方案是创建 vue.config.js在项目根目录(package.json 旁边)resets chunksSortMode of the package html-webpack-plugin :

vue.config.js

module.exports = {
chainWebpack: config => {
config
.plugin('html')
.tap(args => {
args[0].chunksSortMode = 'none'

return args
})
}
}

关于vue.js - 抛出新错误 ('Cyclic dependency' + nodeRep),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51113525/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com