adminjs icon indicating copy to clipboard operation
adminjs copied to clipboard

[Bug]: Incompatibilidad ESM: Error con tiptap y canInsertNode en AdminJS v7.x

Open fabiantorresm opened this issue 4 months ago • 0 comments

Contact Details

Al migrar mi proyecto a ESM y usar AdminJS v7.x, obtengo el siguiente error al iniciar la app

What happened?

Al migrar mi proyecto a ESM y usar AdminJS v7.x, obtengo el siguiente error al iniciar la app:

SyntaxError: The requested module '@tiptap/core' does not provide an export named 'canInsertNode'

Esto ocurre porque AdminJS instala versiones de tiptap y extensiones (como @tiptap/extension-horizontal-rule) que requieren la función canInsertNode, la cual fue removida de @tiptap/core a partir de la versión 2.22.3. Intenté forzar la instalación de @tiptap/[email protected] y actualizar la extensión, pero AdminJS sigue usando dependencias incompatibles internamente.

Pasos para reproducir:

Crear proyecto Node.js con ESM (type: "module" en package.json). Instalar AdminJS v7.x y dependencias recomendadas. Ejecutar el proyecto. Entorno:

Node.js v21.x AdminJS v7.8.17 ESM activado pnpm como gestor de paquetes ¿Solución temporal? No es posible controlar las versiones internas de tiptap que AdminJS instala, por lo que el error persiste.

Referencias:

Issue tiptap #6535 ¿Podrían actualizar las dependencias de tiptap y sus extensiones en AdminJS para evitar este conflicto en ESM?

Bug prevalence

Cuando uso expressjs y adminjs con ESM

AdminJS dependencies version

"packageManager": "[email protected]", "dependencies": { "@adminjs/cli": "^1.0.5", "@adminjs/express": "^6.1.1", "@adminjs/sequelize": "^4.1.1", "@tiptap/core": "2.22.2", "@tiptap/extension-horizontal-rule": "^3.6.6", "adminjs": "^7.8.17", "express": "^5.1.0", "mysql2": "^3.15.2", "sequelize": "^6.37.7", "sqlite3": "^5.1.7" }, "devDependencies": { "nodemon": "^3.1.10" }

What browsers do you see the problem on?

No response

Relevant log output

> [email protected] dev /home/user/Desarrollo/BACKEND JS/expressjs5-adminjs-squelize
> nodemon --trace-warnings app.js

[nodemon] 3.1.10
[nodemon] to restart at any time, enter `rs`
[nodemon] watching path(s): *.*
[nodemon] watching extensions: js,mjs,cjs,json
[nodemon] starting `node --trace-warnings app.js`
(node:2492351) ExperimentalWarning: Importing JSON modules is an experimental feature and might change at any time
    at emitExperimentalWarning (node:internal/util:263:11)
    at ModuleLoader.jsonStrategy (node:internal/modules/esm/translators:474:3)
    at callTranslator (node:internal/modules/esm/loader:279:14)
    at ModuleLoader.moduleProvider (node:internal/modules/esm/loader:285:30)
file:///home/user/Desarrollo/BACKEND%20JS/expressjs5-adminjs-squelize/node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected]__@[email protected]/node_modules/@tiptap/extension-horizontal-rule/dist/index.js:1
import { Node, mergeAttributes, canInsertNode, isNodeSelection, nodeInputRule } from '@tiptap/core';
                                ^^^^^^^^^^^^^
SyntaxError: The requested module '@tiptap/core' does not provide an export named 'canInsertNode'
    at ModuleJob._instantiate (node:internal/modules/esm/module_job:134:21)
    at async ModuleJob.run (node:internal/modules/esm/module_job:217:5)
    at async ModuleLoader.import (node:internal/modules/esm/loader:323:24)
    at async loadESM (node:internal/process/esm_loader:28:7)
    at async handleMainPromise (node:internal/modules/run_main:120:12)

Node.js v21.7.3
[nodemon] app crashed - waiting for file changes before starting...

Relevant code that's giving you issues

import { Node, mergeAttributes, canInsertNode, isNodeSelection, nodeInputRule } from '@tiptap/core';
                                ^^^^^^^^^^^^^
SyntaxError: The requested module '@tiptap/core' does not provide an export named 'canInsertNode'

fabiantorresm avatar Oct 13 '25 23:10 fabiantorresm