Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

package.json exports when using moduleResolution node16 #170

Closed
webdeveric opened this issue May 25, 2023 · 3 comments · Fixed by #197
Closed

package.json exports when using moduleResolution node16 #170

webdeveric opened this issue May 25, 2023 · 3 comments · Fixed by #197

Comments

@webdeveric
Copy link

When using moduleResolution: "node16" in tsconfig.json, the current package.json exports are not enough and TypeScript complains with:

Could not find a declaration file for module 'single-spa-react'. '.../node_modules/single-spa-react/lib/esm/single-spa-react.js' implicitly has an 'any' type.
Try npm i --save-dev @types/single-spa-react if it exists or add a new declaration (.d.ts) file containing declare module 'single-spa-react';

I manually edited your package.json in the node_modules folder and this config makes the error go away.

{
  "exports": {
    ".": {
      "import": {
        "types": "./types/single-spa-react.d.ts",
        "default": "./lib/esm/single-spa-react.js"
      },
      "require": {
        "types": "./types/single-spa-react.d.ts",
        "default":"./lib/cjs/single-spa-react.cjs"
      }
    },
    "./parcel": {
      "import": {
        "types": "./types/single-spa-react.d.ts",
        "default": "./lib/esm/parcel.js"
      },
      "require": {
        "types": "./types/single-spa-react.d.ts",
        "default":"./lib/cjs/parcel.cjs"
      }
    },
    "./package.json": "./package.json"
  }
}
@awx-josh-fu
Copy link

Hi, what's the progress?
I see there was a PR raised, but for what reason it's not yet merged?

@MilanKovacic
Copy link
Contributor

Hi, thank you for reporting the issue.
We are waiting for additional changes before merging the PR.

@MilanKovacic
Copy link
Contributor

I have opened a pull request #197 that will solve the problems. Feel free to help with testing it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants