NPM Link doesn't return any functions / classes of the module

81 Views Asked by At

Hello.

So, when i use npm link ../folder/ToFolder, this is work.

But, when i try to import any function, NOTHING is returned.

Better explanation

I've try to import the module i maked from another folder with npm link. When i try to import my module to the test one, no function is returned from the module i've imported.

My module is in TypeScript, my new test module is in JavaScript, did i did something wrong in the TS one?

Files

// module/src/index.ts

export * from "./functionA";
export * from "./functionB";

// Try in another method:

import { A } from "./functionA";
import { B } from "./functionB";
// These are folder, but they have index.ts that return the file with the functions.
export { A, B };
// test/index.js

const { A, B } = require("module");

const a = A.something();
const b = B.something();
// When i type only "A.", no functions found in autocomplete
1

There are 1 best solutions below

0
refine-wind On

You should check package.json of the module module, make sure the main field is set properly, otherwise,index.js will be used. Check this npm package.json

{ "main": "src/index.js" }