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

Change in output directory when upgrading from 2.3.0 to 3.1.1 #238

Closed
3 tasks done
nstuyvesant opened this issue Jul 7, 2023 · 2 comments
Closed
3 tasks done

Change in output directory when upgrading from 2.3.0 to 3.1.1 #238

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

Comments

@nstuyvesant
Copy link
Contributor

nstuyvesant commented Jul 7, 2023

Describe the bug

In a monorepo I am working on (@carbon/charts), there is a package called core. For that package, when I run yarn build:package with vite-plugin-dts@2.3.0, it runs vite and outputs the type declarations to dist with the correct paths (mirroring src).

When I bump vite-plugin-dts to 3.x (now 3..1.1) with no other configuration changes to tsconfig.json or vite.config.ts, the type declarations are being output to dist/dist/core/src instead of dist as they were previously.

Steps to reproduce:

git clone https://github.com/carbon-design-system/carbon-charts.git
cd carbon-charts
yarn install
cd packages/core
yarn build:package
# Now examine packages/core/dist - type declarations look good because we are on 2.3.0
# Modify packages/core/packages.json and change the version of `vite-plugin-dts` to `^3.1.1`
yarn build:package
# Examine dist and you'll see the type declarations in `dist/dist/core/src` instead of `dist`

Reproduction

See above

Steps to reproduce

See above

System Info

System:
    OS: macOS 13.4.1
    CPU: (10) arm64 Apple M1 Pro
    Memory: 7.32 GB / 32.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 18.16.1 - /opt/homebrew/bin/node
    Yarn: 3.5.1 - /opt/homebrew/bin/yarn
    npm: 9.8.0 - /opt/homebrew/bin/npm
  Browsers:
    Chrome: 114.0.5735.198
    Firefox: 114.0.2
    Safari: 16.5.1
  npmPackages:
    vite: ^4.4.2 => 4.4.2 
    vite-plugin-dts: ^3.1.1 => 3.1.1

Validations

@nstuyvesant
Copy link
Contributor Author

I suspect it is redefining the root as I have a file called packages/core/src/demo/utils/package-versions.ts that imports the package.json files from the other packages. This is technically a TypeScript compilation error because those package.json files are outside of my root directory - but it's also intentional because I don't need to type JSON files and I don't want type declaration generated for all packages.

@qmhc qmhc added the bug Something isn't working label Jul 8, 2023
@qmhc qmhc closed this as completed in 3628877 Jul 8, 2023
@qmhc
Copy link
Owner

qmhc commented Jul 8, 2023

There are some incorrect when process public directory of entries.

Some limitations in v2 (led to some type errors) have gone in v3, the behavior most similar to tsc now. So you can specify entryRoot: 'src' (or override rootDir) to ensure result equivalents to use tsc (after the fix is released).

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