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

[vite:dts] Internal Error: Unable to determine semantic information for declaration #281

Open
3 tasks done
norvalbv opened this issue Oct 31, 2023 · 3 comments
Open
3 tasks done

Comments

@norvalbv
Copy link

norvalbv commented Oct 31, 2023

Describe the bug

`[vite:dts] Internal Error: Unable to determine semantic information for declaration:
/Users/beam/Desktop/Person/react-blogs/src/components/Title/index.tsx:16:9

You have encountered a software defect. Please consider reporting the issue to the maintainers of this application.
✓ built in 3.78s
error during build:
Error: Internal Error: Unable to determine semantic information for declaration:`

When using dts({ rollupTypes: true }) the plugin does not work when destructuring.

For example,

This throws a bug:

  const hi = { hello: 'hi' };
  const { hello } = hi;

this throws a bug:

  const [test, setTest] = useState();

Etc.

full error:

image

From some basic research it seems to be an error with Api-Extractor and you may need to downgrade?

Reproduction

https://github.com/norvalbv/react-blogs

Steps to reproduce

Go to any components folder in /src and put one of those examples above in the code, then simply running yarn build or yarn build --watch will throw an error.

System Info

System:
    OS: macOS 12.4
    CPU: (8) arm64 Apple M1 Pro
    Memory: 110.31 MB / 16.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 18.16.0 - /usr/local/bin/node
    Yarn: 3.6.1 - /usr/local/bin/yarn
    npm: 9.5.1 - /usr/local/bin/npm
  Browsers:
    Chrome: 118.0.5993.117
    Firefox: 119.0
    Safari: 15.5
  npmPackages:
    @vitejs/plugin-react: ^4.1.0 => 4.1.0 
    vite: ^4.5.0 => 4.5.0 
    vite-plugin-dts: ^3.6.3 => 3.6.3

Validations

@qmhc
Copy link
Owner

qmhc commented Nov 1, 2023

I can't reproduce this issue, refer to https://stackblitz.com/~/github.com/qmhc/react-blogs/tree/qmhc/patch-58131.

Maybe you can use a template in stackblitz and create a minimum reproduction.

@norvalbv
Copy link
Author

norvalbv commented Nov 1, 2023

Hey, i've made a new branch and you can see the error caused in src/components

https://github.com/norvalbv/react-blogs/tree/test

The error is still the same, below: :)

image

@qmhc
Copy link
Owner

qmhc commented Nov 30, 2023

Refer to microsoft/rushstack#3875, this maybe a limitation of @microsoft/api-extractor (or TypeScript resolver).

Currently you need to use relative paths:

export * from './components';

or use alias with paths option like the following:

{
  "compilerOptions": {
    "baseUrl": ".",
    "paths": {
      "src/*": ["./src/*"]
    }
  }
}
export * from 'src/components';

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

No branches or pull requests

2 participants