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

build: correct d.ts output dir in development #12212

Merged
merged 1 commit into from
Feb 27, 2023

Conversation

fi3ework
Copy link
Member

Description

In dev mode for vite, d.ts is generated to dist/dist/node which is not correct.

image

While package.json is write as

"types": "./dist/node/index.d.ts",
"exports": {
".": {
"types": "./dist/node/index.d.ts",
"import": "./dist/node/index.js",
"require": "./index.cjs"
},
"./client": {
"types": "./client.d.ts"
},
"./dist/client/*": "./dist/client/*",
"./package.json": "./package.json"

So no d.ts could be found in dev mode.

Change the abs path to a relative path to correct the output behavior. I haven't quite figured out the logic here https://github.com/rollup/plugins/blob/bc5cf91a042b88e14a1da9ba25f501d92591ca8a/packages/typescript/src/index.ts#L152-L182. But seems like it's more conventional to use a relative path as output.dir. So I changed it to relative path and everything goes well now. 😅

image

Additional context


What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

Before submitting the PR, please make sure you do the following

  • Read the Contributing Guidelines.
  • Read the Pull Request Guidelines and follow the PR Title Convention.
  • Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate.
  • Provide a description in this PR that addresses what the PR is solving, or reference the issue that it solves (e.g. fixes #123).
  • Ideally, include relevant tests that fail without this PR but pass with it.

Copy link
Member

@bluwy bluwy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh wow the entire time I just thought they weren't types in dev 🥲 Thank you so much for this, I tested locally and it works for me too.

@bluwy bluwy merged commit b90bc1f into vitejs:main Feb 27, 2023
@fi3ework fi3ework deleted the build-corrent-dev-dts branch February 27, 2023 03:38
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

Successfully merging this pull request may close these issues.

2 participants