0

I'm developing a library for a Typescript codebase that I want to install via npm, but I am not able to import exported members as I would expect. My primary code is Typescript running on v4.7.4. My approach to exposing the imports from my library is as follows:

I have an index.ts that has a export * from "path/to/Component"; for each file that contains members that I want to expose.

This compiles to:

Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("path/to/Component"), exports);

When I import the component in my application via import { Component } from "library";, I get an error Error: Cannot find module 'library/Component', even though I can see that /node_modules/library/build/index.js is in the require stack.

flimsy
  • 204
  • 1
  • 10

0 Answers0