ivandotv / pumpit

PumpIt is a small (<2KB) dependency injection container without the decorators, suitable for the browser.
MIT License
25 stars 2 forks source link

Support --moduleResolution node16 in typescript #38

Closed zkulbeda closed 7 months ago

zkulbeda commented 1 year ago

Hi! I'm really liking this library! Thank you for your work. I use moduleResolution of node16 in my project, and can't import it without errors. image

Then I edit package.json in node_modules

...

  "umd:main": "./dist/prod/index.umd.js",
  "exports": {
    "require": "./dist/prod/index.cjs",
    "default": "./dist/prod/index.modern.js",
+   "types": "./src/index.ts"
  },
  "types": "./dist/types/index.d.ts",
...

But the source files is containing imports without .js extension, so there's other error

image

And last thing I tried is providing url to .d.ts file in exports:

...

  "umd:main": "./dist/prod/index.umd.js",
  "exports": {
    "require": "./dist/prod/index.cjs",
    "default": "./dist/prod/index.modern.js",
-   "types": "./src/index.ts"
+   "types": "./dist/types/index.d.ts"
  },
  "types": "./dist/types/index.d.ts",
...

But it also didn't work. image

Without extensions it just doesn't reexport types in index.d.ts

image

I think the best solution for this problem is providing extensions for import paths and providing type's path to index.d.ts file in exports. What do you think?

ivandotv commented 1 year ago

can you create an example repository?

zkulbeda commented 1 year ago

Yes, see https://github.com/zkulbeda/pumpit_ts

ivandotv commented 7 months ago

@zkulbeda this is now fixed closed via: https://github.com/ivandotv/pumpit/pull/64