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

Release 4.0.4 broke admin.js #96

Open
otsec opened this issue Feb 27, 2024 · 1 comment
Open

Release 4.0.4 broke admin.js #96

otsec opened this issue Feb 27, 2024 · 1 comment

Comments

@otsec
Copy link

otsec commented Feb 27, 2024

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()
@dziraf
Copy link
Contributor

dziraf commented Feb 27, 2024

@otsec 4.0.5 should fix the problem.

It is odd since the issue was related to incorrect import from date-fns but at the same time 4.0.4 didn't change anything related to it.

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