adminjs: Component1 is not defined
I’m attempting to render a property with a custom component, but it won’t work and the console is showing me this error:
components.bundle.js:9 Uncaught ReferenceError: Component1 is not defined at components.bundle.js:9
I literally copy pasted the example from the docs to make sure i wasn’t doing anything wrong, but it doesn’t work.
Also I’ve seen that some places in the docs you use components: {} instead of component: {}
This is how im trying to do it:
{ resource: Voyage, options: { properties: { status: { component: { list: AdminBro.require('./city-content-in-list'), }, }, }, }, },
the component is a copy paste of your example in the docs.
What confuses me is that in your repo admin-bro-example-app you add a custom component to the article field, but you apply the component like this:
properties: { _id: { isVisible: false }, content: { type: 'richtext', }, published: { label: 'Published (custom render)', components: { list: AdminBro.require('../components/article-in-list') } } }
What’s the difference between those two?
If i use components i get another error
(Invariant Violation: Element type is invalid) apparently it got undefined?
Anyway i just dont understand why it doesn’t work when I’ve followed the docs closely!
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 1
- Comments: 25 (10 by maintainers)
This is the output of my hidden adminbro file
AdminBro.UserComponents = {} import Component1 from '..\routes\my-dashboard-component' AdminBro.UserComponents.Component1 = Component1This is the error that I’m getting or rather output
outesmy-dashboard-component' is imported by .adminbro\.entry.js, but could not be resolved – treating it as an external dependency outesmy-dashboard-component' in output.globals – guessing 'Component1'This is how I’m importing the component
dashboard: { component: AdminBro.require('./my-dashboard-component') }what I’m i doing wrong?