Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error with vue3 #42

Open
xcloud2021 opened this issue Mar 18, 2021 · 1 comment
Open

Error with vue3 #42

xcloud2021 opened this issue Mar 18, 2021 · 1 comment

Comments

@xcloud2021
Copy link

I'm trying to use this great editor with vue3 in my project, using the simplest example from here.

It come out with error:
vue-json-editor.vue:17 Uncaught SyntaxError: The requested module '/node_modules/vue-json-editor/assets/jsoneditor.js' does not provide an export named 'default'

Can I use this editor in vue3? Then how?

@frenchcdsl44
Copy link

there is a fork here :
https://github.com/joaomede/vue3-json-editor

beatrizsmerino added a commit to beatrizsmerino/vue-editor that referenced this issue Mar 20, 2024
Error:
- vue-router.js?v=9325602b:1692 SyntaxError: The requested module '/node_modules/vue-json-editor/assets/jsoneditor.js?v=9325602b' does not provide an export named 'default' (at vue-json-editor.vue:3:8)
- EditorJSON.vue:89 [Vue warn]: Failed to resolve async component: () => import("/node_modules/vue-json-editor/vue-json-editor.vue")
Reason: SyntaxError: The requested module '/node_modules/vue-json-editor/assets/jsoneditor.js?v=9325602b' does not provide an export named 'default'

Solution:
- Dynamically imports the `VueJsonEditor` component.

Reason:
- With this change we can now navigate to the `editors` page although the problem about the `VueJsonEditor` component persists.
It seems that the `vue-json-editor` package is not compatible with `vite` because it is not prepared for use with `ESModules`.
This is a temporary solution to be able to access the page, but you will have to replace the `vue-json-editor` package with another one that has the same functionality and is compatible.

References:
- https://www.npmjs.com/package/vue-json-editor
- dirkliu/vue-json-editor#42
- dirkliu/vue-json-editor#51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants