作者热门文章
- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
我在我的应用程序中使用了很多图表,我想尽可能地处理 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/
我在我的应用程序中使用了很多图表,我想尽可能地处理 vuex 存储中的所有图表颜色。我使用下面的代码来实现这一点。 store.js import Vue from 'vue' import Vuex
我是一名优秀的程序员,十分优秀!