tiavina-mika / mui-tiptap-editor

Tiptap editor with Material UI
https://www.npmjs.com/package/mui-tiptap-editor
17 stars 2 forks source link

Module not found: Error: Can't resolve '...' #22

Closed TuKun33 closed 2 months ago

TuKun33 commented 3 months ago

import { TextEditor } from 'mui-tiptap-editor';

ERROR in ./src/components/RichEditor/index.jsx 10:30-40
export 'TextEditor' (imported as 'TextEditor') was not found in 'mui-tiptap-editor' (module has no exports)

ERROR in ./node_modules/mui-tiptap-editor/dist/esm/index.js 1:0-64
Module not found: Error: Can't resolve './components/TextEditor' in 'C:\Users\Tukun\Documents\Workspace\YeIo\ayatt-admin-ui\node_modules\mui-tiptap-editor\dist\esm'
Did you mean 'TextEditor.js'?
BREAKING CHANGE: The request './components/TextEditor' failed to resolve only because it was resolved as fully specified
(probably because the origin is strict EcmaScript Module, e. g. a module with javascript mimetype, a '*.mjs' file, or a '*.js' file where the package.json contains '"type": "module"').
The extension in the request is mandatory for it to be fully specified.
Add the extension to the request.

ERROR in ./node_modules/mui-tiptap-editor/dist/esm/index.js 2:0-80
Module not found: Error: Can't resolve './components/TextEditorReadOnly' in 'C:\Users\Tukun\Documents\Workspace\YeIo\ayatt-admin-ui\node_modules\mui-tiptap-editor\dist\esm'
Did you mean 'TextEditorReadOnly.js'?
BREAKING CHANGE: The request './components/TextEditorReadOnly' failed to resolve only because it was resolved as fully specified
(probably because the origin is strict EcmaScript Module, e. g. a module with javascript mimetype, a '*.mjs' file, or a '*.js' file where the package.json contains '"type": "module"').
The extension in the request is mandatory for it to be fully specified.
Add the extension to the request.

ERROR in ./node_modules/mui-tiptap-editor/dist/esm/index.js 3:0-58
Module not found: Error: Can't resolve './components/Toolbar' in 'C:\Users\Tukun\Documents\Workspace\YeIo\ayatt-admin-ui\node_modules\mui-tiptap-editor\dist\esm'
Did you mean 'Toolbar.js'?
BREAKING CHANGE: The request './components/Toolbar' failed to resolve only because it was resolved as fully specified
(probably because the origin is strict EcmaScript Module, e. g. a module with javascript mimetype, a '*.mjs' file, or a '*.js' file where the package.json contains '"type": "module"').
The extension in the request is mandatory for it to be fully specified.
Add the extension to the request.
tiavina-mika commented 3 months ago

which version are you using?

tiavina-mika commented 3 months ago

fixed, please update to the latest version with yarn add mui-tiptap-editor@latest

TuKun33 commented 3 months ago

fixed, please update to the latest version with yarn add mui-tiptap-editor@latest

Thanks! I have updated the latest version 0.3.2, but it still has the same error, which seems to be similar to this issue

tiavina-mika commented 3 months ago

can you please provide your environment? Node version npmor yarn version mui version

TuKun33 commented 3 months ago

can you please provide your environment? Node version npmor yarn version mui version

Node v20.12.2 npm v10.5.0 mui v5.10.5

tiavina-mika commented 2 months ago

It's a typescript issue, The import should have an extension.

import x from "./mymodule"

should be

import x from "./mymodule.js"

There are well known debates in related issues requests opened for the tsc team on GitHub #27481 and #11901, but with no resolutions.

So as for now my solution is using this lib: ts-add-js-extension.

So upgrade to the latest mui-tiptap-editor version would fix the issue