vue项目 webpack 引入 echarts 第一次进如没有问题 刷新就会报错500 显示__DEV__ not defined
option = {
color: colors,
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'cross'
}
},
grid: {
right: '20%'
},
toolbox: {
feature: {
dataView: {show: false, readOnly: true},
saveAsImage: {show: true}
}
},
legend: {
data:['打印数量','扫码数量','扫码率']
},
xAxis: [
{
type: 'category',
axisTick: {
alignWithLabel: true
},
data: this.xAxisdata
}
],
yAxis: [
{
type: 'value',
name: '数量',
position: 'right',
axisLine: {
lineStyle: {
color: colors[0]
}
},
axisLabel: {
// formatter: '{value} ml'
}
},
{
type: 'value',
name: '扫码率',
min: 0,
max: 100,
position: 'left',
axisLine: {
lineStyle: {
color: colors[2]
}
},
axisLabel: {
formatter: '{value} %'
}
}
],
dataZoom: [
{
type: 'slider',
show: true,
start: 1,
end: 3
}
],
series: [
{
name:'打印数量',
type:'bar',
data:this.printedata,
},
{
name:'扫码数量',
type:'bar',
data:this.scandata
},
{
name:'扫码率',
type:'line',
yAxisIndex: 1,
data:this.scanratedata
}
]
}
能发发一下你完整的能复现的项目
自己定位了一下错误 我这个是vue-cli搭建的项目 现在是只要引用echarts 第一次进没有问题 刷新就会报上面的图的错误 500的错误 不引入没问题
这个是编译时的环境变量,如果你是 webpack 的话可以考虑参考 https://github.com/ecomfe/echarts/blob/master/webpack.config.js#L7 加入
老铁我跟你是一样的问题,有什么解决的方法啊
还是不行。是我没改对么。。。我在webpack.base.conf.js里面加了var webpack = require("webpack")
,
I have the same issue but I am using angular cli. Should I define this __DEV__ variable somewhere like the environment.ts or environment.prod.ts ?
我的问题和vue中 import 失败 #6987是一样的,用的也是vue2.但是我按照里面的方法试了一遍还是不行,老铁会说中文么。
@zsychy
在 webpack的配置里面加一个配置
plugins: [
new webpack.DefinePlugin({
__DEV__: false
})
]
我加了,但是我不知道加在那一块里面。。可能没加对地方。。 @hefeng1208
@zsychy webpack.base.conf.js 或者说你的配置文件里面 设置插件的地方
是module下面的rules块里面么。。。萌新没设置过插件
就是在build\webpack.dev.conf.js 里面的plugins参数
angular4也是一样的问题,echarts最新版本
function enableClassExtend(RootClass, mandatoryMethods) {
RootClass.$constructor = RootClass;
RootClass.extend = function (proto) {
if (__DEV__) {
__WEBPACK_IMPORTED_MODULE_0_zrender_src_core_util__["each"](mandatoryMethods, function (method) {
if (!proto[method]) {
console.warn(
'Method `' + method + '` should be implemented'
+ (proto.type ? ' in ' + proto.type : '') + '.'
);
}
配置了 // 定义环境变量
new webpack.DefinePlugin({
PRODUCTION: JSON.stringify(PRODUCTION),
DEVELOPMENT: JSON.stringify(DEVELOPMENT),
__DEV__: false
}),
不起作用
@xiguayizu,@hefeng1208,@darkurse,
谢谢各位大佬。。。vue2下面是build\webpack.dev.conf.js,不是Base
我刚才使用3.8版本,也遇到这个问题了 https://github.com/ecomfe/echarts/issues/7000, 使用老版本解决了
cnpm i [email protected]
我们在新发布的 3.8.2 中将 lib 下的重新转译成了 CommonJS 格式并且去掉了 __DEV__,应该解决了大家构建的兼容问题。非常抱歉新版本的模块系统给大家造成了这么大的麻烦。
刚升级了 3.8.2 没问题了,辛苦!
@pissang 是不是对应的像echarts-for-react,或者react-native的包他们的依赖都要更新一下,不然还是不行呢~
@KaroseLiu 应该不需要,只要不要安装到 3.8.0 就行了
@pissang老铁。。我现在更新到3.8.2了。但是我type:line的时候报错undefined的了。
3.8.0版本的echarts地图都不出来,一直在报TypeError: targetList is undefined的错@pissang
font{
line-height: 1.7;
}
ul,ol{
list-style-position: inside;
}
可以升级一下版本试试
a#ntes-pcmail-signature-default:hover {
text-decoration: underline;
color: #199cff;
cursor: pointer;
}
a#ntes-pcmail-signature-default:active {
text-decoration: underline;
color: #246fce;
cursor: pointer;
}
在2017年11月13日 17:38,raindew2016<[email protected]> 写道:
3.8.0版本的echarts地图都不出来,一直在报TypeError: targetList is undefined的错
—You are receiving this because you commented.Reply to this email directly, view it on GitHub, or mute the thread.
Most helpful comment
我们在新发布的 3.8.2 中将 lib 下的重新转译成了 CommonJS 格式并且去掉了 __DEV__,应该解决了大家构建的兼容问题。非常抱歉新版本的模块系统给大家造成了这么大的麻烦。