ERROR in node_modules/@editorjs/editorjs/types/api/block.d.ts:2:25 - error TS2307: Cannot find module '../../src/types-internal/block-data'.
So basically it's trying to import from src folder, but there is no src folder in the @editorjs/editorjs when i use the 'npm install @editorjs/editorjs --save-dev'.
I am aware that there is an ngx-editorjs package, but I'm really frustrated by this issue.
Any help would be highly appreciated.
I also have the same bug
help
Me too... My CI log ends with
ERROR in node_modules/@editorjs/editorjs/types/api/block.d.ts:2:25 - error TS2307: Cannot find module '../../src/types-internal/block-data'.
2 import {SavedData} from '../../src/types-internal/block-data';
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Running after_script
Uploading artifacts for failed job
ERROR: Job failed: exit code 1
This happened when I updated EditorJS today.
Same here when I updated dependencies.
Install and force a previous version of editorjs (and plugins) with package.json worked for me until they will patch the error:
"@editorjs/editorjs": "2.17.0",
and then:
npm install
There's a slightly easier way, just ask npm to install an exact version:
npm install @editorjs/[email protected]
Don't forget to install the latest version when the fix for this issue is available (npm install @editorjs/editorjs@latest)
@tommiv, @juanmigonzalez thanks, works for me
I've investigated the issue and because /src/ folder is not included in the library published to npm, the typing file block-data.d.ts does not exist.
I think it we can fix this by moving the type file from /src/types-internal/block-data.d.ts to /types/api/block-data.d.ts and refactoring all its import declarations.
Proof: Testing by simply adding block-data.d.ts to node_modules in my project works.
I can add a PR with the changes if I have the approval from you guys.
Thanks!
FYI: For me, the previous fix is not a solver, because @2.17.0 doesn't work with the latest plugins, and @2.18.0 give this typing error.
PS:
A cross device temporary fix that I'm using for the time being:
editorjs-typing-fix containing:block-data.d.ts - copy it from github /src/types-internal/block.d.ts with import refactored import {SavedData} from './block-data';package.json "postinstall": "npm run editorjs-typing-fix",
"editorjs-typing-fix": "cp -R editorjs-typing-fix/ node_modules/@editorjs/editorjs/types/api/",
@editorjs/[email protected] in package.jsonnpm installThanks for the workaround @tiberiumihai you saved me from stalling progress on an important feature!
Would be keen to see this PR'd and corrected quickly!
Is this fixed with latest version? I have made some changes to this project and built and linked it, it all works fine locally, built I have built the project with the prod script and pushed the changes after the build as I am waiting for my pull request to be reviewed.
My issue is that when I install the remote branch and serve the app, I get the reported error on the
import {SavedData} from '../../src/types-internal/block-data';
Getting the same error.
Seems like no type definitions files (*.d.ts) are generated for the files under src, but other type definitions (e.g. this block.d.ts) depend on them.
@RicoBrase my workaround was to follow on what @tiberiumihai suggested:
I think it we can fix this by moving the type file from /src/types-internal/block-data.d.ts to /types/api/block-data.d.ts and refactoring all its import declarations.
@Teebo Currently working on an easy workaround PR by modifying the .npmignore file. That way, one doesn't have to move around any files.
@RicoBrase Great!
Most helpful comment
I've investigated the issue and because
/src/folder is not included in the library published to npm, the typing fileblock-data.d.tsdoes not exist.I think it we can fix this by moving the type file from
/src/types-internal/block-data.d.tsto/types/api/block-data.d.tsand refactoring all its import declarations.Proof: Testing by simply adding
block-data.d.tsto node_modules in my project works.I can add a PR with the changes if I have the approval from you guys.
Thanks!
FYI: For me, the previous fix is not a solver, because
@2.17.0doesn't work with the latest plugins, and@2.18.0give this typing error.PS:
A cross device temporary fix that I'm using for the time being:
editorjs-typing-fixcontaining:*
block-data.d.ts- copy it from github/src/types-internal/*
block.d.tswith import refactoredimport {SavedData} from './block-data';package.json@editorjs/[email protected]in package.jsonnpm install