-
Notifications
You must be signed in to change notification settings - Fork 525
Description
Prerequisites
-
There isn't an existing issue that reports the same bug to avoid duplicates.
-
The provided information offers a minimal reproducible example of the bug, (Why create a Minimal).
-
For Q&A, please open a GitHub Discussion instead.
Version
v0.10.3
Reproduction Link
No response
Describe the Bug
按照官方文档:
import cherry from 'cherry';
import echarts from 'echarts';
import echartsEngine from 'cherry/dist/addons/advance/cherry-table-echarts-plugin';
cherry.usePlugin(echartsEngine , { echarts });
报错
先决条件:基于vue2.x,通过npm安装了cherry-markdown 0.10.3
引入:
import Cherry from "cherry-markdown";
import * as echarts from 'echarts';
import EChartsTableEngine from "cherry-markdown/dist/addons/advance/cherry-table-echarts-plugin";
使用:
在initConfig中(Cherry实例化之前)
Cherry.usePlugin(EChartsTableEngine,{echarts} )
报错:
vue-router.esm.js:2316 ReferenceError: require is not defined
at eval (cherry-table-echarts-plugin.js:2:1)
at ./node_modules/cherry-markdown/dist/addons/advance/cherry-table-echarts-plugin.js (src_views_writeview_ArticleWriteView_vue.js:62:1)
at webpack_require (index.js:1759:32)
at fn (index.js:2057:21)
at eval (index.js??clonedRuleSet-40.use[0]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/markdown/evan-cherry-editor.vue?vue&type=script&lang=js:14:121)
at ./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[0]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/markdown/evan-cherry-editor.vue?vue&type=script&lang=js (src_views_writeview_ArticleWriteView_vue.js:40:1)
at webpack_require (index.js:1759:32)
at fn (index.js:2057:21)
at eval (evan-cherry-editor.vue?vue&type=script&lang=js:2:231)
at ./src/components/markdown/evan-cherry-editor.vue?vue&type=script&lang=js (src_views_writeview_ArticleWriteView_vue.js:159:1)
at webpack_require (index.js:1759:32)
at fn (index.js:2057:21)
at eval (evan-cherry-editor.vue:3:105)
at ./src/components/markdown/evan-cherry-editor.vue (src_views_writeview_ArticleWriteView_vue.js:148:1)
at webpack_require (index.js:1759:32)
at fn (index.js:2057:21)
at eval (index.js??clonedRuleSet-40.use[0]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/views/writeview/ArticleWriteView.vue?vue&type=script&lang=js:8:101)
at ./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[0]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/views/writeview/ArticleWriteView.vue?vue&type=script&lang=js (src_views_writeview_ArticleWriteView_vue.js:51:1)
at webpack_require (index.js:1759:32)
at fn (index.js:2057:21)
at eval (ArticleWriteView.vue?vue&type=script&lang=js:2:229)
at ./src/views/writeview/ArticleWriteView.vue?vue&type=script&lang=js (src_views_writeview_ArticleWriteView_vue.js:237:1)
at webpack_require (index.js:1759:32)
at fn (index.js:2057:21)
at eval (ArticleWriteView.vue:3:103)
at ./src/views/writeview/ArticleWriteView.vue (src_views_writeview_ArticleWriteView_vue.js:226:1)
at webpack_require (index.js:1759:32)
at fn (index.js:2057:21)
如果在config中直接配置:
engine: {
global: {
flowSessionContext:true,
flowSessionCursor:'default',
},
syntax: {
inlineCode: {
selfClosing:true,
showColor:true,
},
table: {
enableChart: true, // 启用图表功能
chartRenderEngine: EChartsTableEngine,
externals: ['echarts'],
},
也会出现同样的错误
System Information
Contributing
None