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

Regression in sources paths in declaration maps #245

Closed
3 tasks done
ekwoka opened this issue Jul 16, 2023 · 2 comments
Closed
3 tasks done

Regression in sources paths in declaration maps #245

ekwoka opened this issue Jul 16, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@ekwoka
Copy link

ekwoka commented Jul 16, 2023

Describe the bug

v 3.3.0 has broken the source paths in the dts files

dts({
      entryRoot: resolve(__dirname, 'src'),
      tsconfigPath: resolve(__dirname, 'tsconfig.json'),
})

This would, with 3.2.0 provide declaration maps that looked like

{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,KAAK,YAEjB,CAAC"}
    

But with 3.3.0 they look like

{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/src/index.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,KAAK,YAEjB,CAAC"}

Which doesn't work at all. There is no src/src directory.

I guess technically both are wrong? tsc alone would have the path be ../src/index.ts

Reproduction

https://github.com/ekwoka/create-kwoka-pkg

Steps to reproduce

In above repo, the focus is the nested project under kwoka-pkg directory. It's basically just a scaffold.

Just add src/index.ts in the source with whatever.

Run build.

Then update vite-plugin-dts and run build again.

The source paths are different.

But if you do pnpm exec tsc the source paths are also different...

So something is wrong here, but 3.3.0 of this plugin is definitely most wrong.

System Info

System:
    OS: macOS 13.4.1
    CPU: (8) arm64 Apple M1 Pro
    Memory: 104.64 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.3.1 - ~/Library/pnpm/node
    Yarn: 1.22.19 - ~/Library/pnpm/yarn
    npm: 9.6.7 - ~/Library/pnpm/npm
    pnpm: 8.6.7 - ~/Library/pnpm/pnpm
  Browsers:
    Chrome: 114.0.5735.198
    Edge: 114.0.1823.82
    Safari: 16.5.2

Validations

@qmhc
Copy link
Owner

qmhc commented Jul 17, 2023

Could you provide a reproduction?

@qmhc qmhc added the bug Something isn't working label Jul 17, 2023
@qmhc qmhc closed this as completed in 0d84180 Jul 17, 2023
@ekwoka
Copy link
Author

ekwoka commented Jul 17, 2023

Beautiful! Thank you!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants