Open Yxliam opened 4 years ago
建议提可以完善下这个模板中的内容
问题描述 打包的时候提示npm/taro-echarts/components/ec-canvas/ec-canvas 包超过500kb跳过编译和压缩
线上出现:
Component is not found in path "npm/taro-echarts/components/ec-canvas/ec-canvas" (using by "npm/taro-echarts/components/Chart/index");onAppRoute
Error: Component is not found in path "npm/taro-echarts/components/ec-canvas/ec-canvas" (using by "npm/taro-echarts/components/Chart/index")
报错信息
1、打包的时候提示npm/taro-echarts/components/ec-canvas/ec-canvas 包超过500kb跳过编译和压缩
2、Component is not found in path "npm/taro-echarts/components/ec-canvas/ec-canvas" (using by "npm/taro-echarts/components/Chart/index");onAppRoute
Error: Component is not found in path "npm/taro-echarts/components/ec-canvas/ec-canvas" (using by "npm/taro-echarts/components/Chart/index")
系统信息 mac
微信小程序报错是打包的时候报错还是运行时候报错呢
@eyelly-wu 运行的时候没有报错,提示超过500k跳过了编译了压缩,打包的时候因为没有压缩超过了500kb,导致整个应用包过大,勾选上传压缩,可以上传,问题是线上出现了Component is not found in path "npm/taro-echarts/components/ec-canvas/ec-canvas" (using by "npm/taro-echarts/components/Chart/index");onAppRoute Error: Component is not found in path "npm/taro-echarts/components/ec-canvas/ec-canvas" (using by "npm/taro-echarts/components/Chart/index")
哦哦,大致了解了,由于我好长时间没有做Taro项目了,我先给个解决方案,你来测试ok不 这是echarts-for-weixin项目给出的文件过大解决方案,就是去定制我们需要的图表,下载保存在我们项目的某个位置 然后修改Taro的配置,
patterns: [
// 之前写的复制配置,忽略echarts.js
{
from: 'node_modules/taro-echarts/components/ec-canvas/',
to: 'dist/npm/taro-echarts/components/ec-canvas',
ignore: ['ec-canvas.js', 'wx-canvas.js','echarts.js']
},
// 添加新的copy规则,将
{
from: '保存定制echarts的路径',
to: 'dist/npm/taro-echarts/components/ec-canvas',
}
]
你可以试试看
开发环境也是显示: BABEL] Note: The code generator has deoptimised the styling of "/Users/yxl/project/myProject/cloneDemo/toolTaro/node_modules/taro-echarts/components/ec-canvas/echarts.js" as it exceeds the max of "500KB". 整个echarts.js 是我定制下载的
定制的echarts文件应该小很多了吧?难道是copy配制没生效?现在小程序中的echarts是你定制的echarts吗
@eyelly-wu 是啊自己定制的echarts 大小300kb左右
那报错怎么还超过500k呢?
@eyelly-wu 感觉应该是copy没有生效
copy: {
patterns: [
// 需添加如下配置
{
from: "src/components/ec-canvas",
to: "dist/npm/taro-echarts/components/ec-canvas",
ignore: ["ec-canvas.js", "wx-canvas.js", "echarts.js"]
}
],
options: {}
},
有找到解决方案么
这项目还维护吗?
@ldwonday 要维护的哟
我也试了一下,感觉是后面的copy没有把前面的覆盖掉,而且前面的ignore部分貌似也是没有生效
我测试是ok的啊 copy配置 生成的小程序代码中,echarts也的确是定制的 定制的echarts文件
@vinurs 你生成的小程序代码中的echarts不是自己定制的吗?
在dist/npm/taro-echarts/components/ec-canvas下面我ls了一下 我定制的文件的大小 可以看出确实没有覆盖掉
包裹太大 这个问题现在 有 有效的解决办法吗/?
手动替换掉之后真机预览 提示不合法的文件
@zhidali 目前我没找到好的解决方案
1.手动替换是替换哪个目录下的文件呢 2.手动替换后开发工具上能够正常预览吗
在dist/npm/taro-echarts/components/ec-canvas下面我ls了一下 我定制的文件的大小 可以看出确实没有覆盖掉
我用这种方法也正常
@Thinking80s 你说的正常是定制的echarts生效了吗?
@Thinking80s 你说的正常是定制的echarts生效了吗?
是的
老哥们 你们这个问题有解决吗 我的taro迁移到2.x了,定制echarts.js,通过copy也没能覆盖原来的700多k的,我都想直接把node_modules复制出来改了,根本就打不了包了。。难顶
如果大家谁有好的解决方案,欢迎提PR
如果大家谁有好的解决方案,欢迎提PR
老哥 我fix 了,可以打包上传了,我也是定制的echarts.js 打包需要忽略node_modules的就好了,因为我是2.x,你之前配置的 ignore其实是无效的,需要补充配置。有空的话 我提个PR吧,到时你review下。
我总结到了自己的一个repo 大家可以参考一下,希望对大家有帮助:
提示:Component is not found in path "npm/taro-echarts/components/ec-canvas/ec-canvas" (using by "npm/taro-echarts/components/Chart/index");onAppRoute Error: Component is not found in path "npm/taro-echarts/components/ec-canvas/ec-canvas" (using by "npm/taro-echarts/components/Chart/index")