I just wanted to try admin.js for the first time and spent a couple of hours trying to understand why it wasn't working. I got an error:
(node:71680) ExperimentalWarning: Importing JSON modules is an experimental feature and might change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
node:internal/process/esm_loader:34
internalBinding('errors').triggerUncaughtException(
^
Error [ERR_UNSUPPORTED_DIR_IMPORT]: Directory import '/Users/otsec/Code/asynca/adminjs/node_modules/date-fns/parseISO' is not supported resolving ES modules imported from /Users/otsec/Code/asynca/adminjs/node_modules/@adminjs/design-system/build/molecules/date-picker/useDatePicker.js
Did you mean to import date-fns/parseISO/index.js?
at finalizeResolution (node:internal/modules/esm/resolve:258:11)
at moduleResolve (node:internal/modules/esm/resolve:917:10)
at defaultResolve (node:internal/modules/esm/resolve:1130:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:396:12)
at ModuleLoader.resolve (node:internal/modules/esm/loader:365:25)
at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:240:38)
at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:85:39)
at link (node:internal/modules/esm/module_job:84:36) {
code: 'ERR_UNSUPPORTED_DIR_IMPORT',
url: 'file:///Users/otsec/Code/asynca/adminjs/node_modules/date-fns/parseISO'
}
Node.js v20.11.1
It works when I manually downgrade design system to 4.0.3.
How to reproduce
It tried it with AdonisJS, but you can reproduce it on fresh setup:
Init npm in new dir npm init -y
Add "type": "module" to package.json
Install adminjs npm i adminjs.
The following index.js that I copied from the docs.
import AdminJS from 'adminjs'
const adminJS = new AdminJS({
// ...
})
adminJS.watch()
Hi there!
I just wanted to try admin.js for the first time and spent a couple of hours trying to understand why it wasn't working. I got an error:
It works when I manually downgrade design system to 4.0.3.
How to reproduce
It tried it with AdonisJS, but you can reproduce it on fresh setup:
npm init -y
"type": "module"
to package.jsonnpm i adminjs
.