Closed Inoir closed 7 months ago
I'm having the exact same issue when deploying to prod.
components.bundle.js:1 Uncaught TypeError: (0 , r.default) is not a function
at components.bundle.js:1:5170
at components.bundle.js:1:6495
at components.bundle.js:1:7384
react_devtools_backend.js:4012 Error: Component "Avatar" has not been bundled, ensure it was added to your ComponentLoader instance (the one included in AdminJS options).
at f (app.bundle.js:9:156344)
at El (global.bundle.js:21:62944)
at Cs (global.bundle.js:21:119997)
at wc (global.bundle.js:21:108959)
at yc (global.bundle.js:21:108887)
at gc (global.bundle.js:21:108749)
at ic (global.bundle.js:21:105553)
at ac (global.bundle.js:21:104103)
at S (global.bundle.js:11:1374)
at MessagePort.R (global.bundle.js:11:1906)
It seems the issue is related to this line:
Where componentLoader isn't checked for the component existence, only the global UserComponents object, which is loaded from the adminjs/.entry.js
file, and that file only gets written to in dev mode by admin.watch()
. Makes sense to let us pass our components directly rather than file paths so any commonjs, es module, build environment, etc. complexity is abstracted away and left to the consumers of the library. Regardless, thanks for the hard work! This is a wonderful project.
thanks for the hint @conoremclaughlin fixed it for now with just replacing the path in die .entry.js. since there is /src/ in there, we just replace in the pipeline with /dist/ and its working for now.
Describe the bug Ive added some custom components. All working fine on develop mode. As soon i build everything for production, the app cant find the components anymore. The components.bundle.js looks okay. components are in this file and also referenced on UserComponents on the adminjs object. Still doesnt render the components, instead show error from title, i should add components to componentloader.
Installed libraries and their versions
To Reproduce Cant, cause it works local. so i expect it also works on prod mode
Expected behavior Should render the components without error
Screenshots
Additional context There is a difference between the rendered dashboard custom component and the list-tag component output in the file. Dashboard ist wrapped with an function and exports default inside of this function. list tags just sets _default var and isnt wrapped in any function. Still dashboard isnt replaced also