Skip to content

Release 4.0.4 broke admin.js #96

@otsec

Description

@otsec

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:

(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:

  1. Init npm in new dir npm init -y
  2. Add "type": "module" to package.json
  3. Install adminjs npm i adminjs.
  4. The following index.js that I copied from the docs.
import AdminJS from 'adminjs'

const adminJS = new AdminJS({
  // ...
})

adminJS.watch()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions