"createElement() has been called outside of render function" when used inside wrapper
See original GitHub issue- I can confirm this problem is not reproducible with ECharts itself.
How are you introducing Vue-ECharts into your project?
ES Module imports
Versions
vue-start-template-web@0.1.0 /Users/jclaessens/dev/projects/xxx/npmpackages/vue-start-template-web
├─┬ bm-echarts@0.0.1 extraneous -> /Users/jclaessens/dev/projects/xxx/npmpackages/bm-echarts
│ ├─┬ @vue/composition-api@1.0.3 extraneous
│ │ └── vue@2.6.14 extraneous
│ ├── echarts@5.1.2 extraneous
│ └─┬ vue-echarts@6.0.0-rc.6 extraneous
│ ├── echarts@5.1.2 deduped
│ ├─┬ vue-demi@0.9.1 extraneous
│ │ └── vue@2.6.14 deduped
│ └── vue@2.6.14 deduped
├─┬ bm-web-core@2.4.0
│ └── vue@2.6.14 deduped
└── vue@2.6.14
Details
Our company wraps all external libraries to provide an internal stable & reusable api. Vue-Echarts is working when I use it directly, but as soon as I add a wrapper around it, it throws the following:
[Vue warn]: createElement() has been called outside of render function.
.
Our web template doesn’t use @vue/composition-api
, so I suspect it has something to do with that, but I don’t have any experience with the composition api yet. We do want to use the latest e-charts lib so we would like to use the latest vue-echarts library as well.
Reproduction (didn’t know how to replicate this in a CodeSandbox)
- Take the SFC example for Vue2, put it in
echarts.vue
file. - Create a seperate npm module with following dependencies:
"@vue/composition-api": "^1.0.3",
"echarts": "^5.1.2",
"vue-echarts": "^6.0.0-rc.6"
- export that component in an
index.js
file withexport { default } from './echarts';
- use
npm link
to use it in a vue2 project - use that component
- See console error on page load
Reproduction
/
Issue Analytics
- State:
- Created 2 years ago
- Comments:13 (5 by maintainers)
Top Results From Across the Web
createElement() has been called outside of render function ...
createElement() has been called outside of render function. when handleSuccessMessage function used #804.
Read more >vue2.7 `createElement()` has been called outside of render ...
vue2.7 setup will tips [Vue warn]: createElement() has been called outside of render function. @vue/composition-api is work before.
Read more >Vue Render Functions: What (and How) to Use Them - Snipcart
A render function returns a virtual DOM node, commonly named VNode in the Vue ecosystem, which is an interface that allows Vue to...
Read more >createelement() has been called outside of render function-掘金
报错指示:createelement() has been called outside of render function. 报错原因:在包装器包中的依赖项中没有vue,因此vue-demi 将假定您默认使用Vue 3。
Read more >API Reference | Preact
The render function is passed the component's current props and state, and should return a Virtual DOM Element (typically a JSX "element"), an...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Try this:
Install
@nuxtjs/composition-api
and add'@nuxtjs/composition-api/module'
to thebuildModules
array innuxt.config.js
.I’m using nuxt, and I’ve spent a lot of time on this issue. And, I solved it by adding the settings below.
add below to nuxt.config.js
I hope it helps someone.
@Justineo, you saved my life. https://github.com/ecomfe/vue-echarts/issues/644#issuecomment-1211434054