I created a fork of another package and published it under a unique, new name:
https://www.npmjs.com/package/feed-media-fork
I tagged a new version, created a release on github and yarn add feed-media-fork
or the corresponding npm install feed-media-fork
forks fine.
However, when importing the library, typescript complains about “module not found”.
import { Extension, Feed, FeedOptions } from 'feed-media-fork';
Result:
error TS2307: Cannot find module 'feed-media-fork' or its corresponding type declarations.
What do I miss here?
You need to compile your library
# inside your library folder
npm install -g typescript
npm run build
then the import works
Here’s the files from your package:
https://www.npmjs.com/package/feed-media-fork?activeTab=code
This package is missing the compiled .js
files and the .d.ts
files. Inluding .ts
files is not strictly needed for npm packages.
Usually I just recommend specfying the ‘files’ property in package.json
to explicitly specify what you want in your package. If this is not included I’m pretty sure NPM uses .gitignore
which excludes your compiled files.