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

extends in tsconfig.json should prefer tsconfig.json over package.json #15371

Closed
7 tasks done
JounQin opened this issue Dec 17, 2023 · 1 comment · Fixed by #15502
Closed
7 tasks done

extends in tsconfig.json should prefer tsconfig.json over package.json #15371

JounQin opened this issue Dec 17, 2023 · 1 comment · Fixed by #15502
Labels
bug: upstream Bug in a dependency of Vite p3-minor-bug An edge case that only affects very specific usage (priority)

Comments

@JounQin
Copy link
Contributor

JounQin commented Dec 17, 2023

Describe the bug

// lib/tsconfig.json
{
  "extends": "..", // it means `../tsconfig.json` actually, but `../package.json#main` is resolved unexpectedly
  "compilerOptions": {
    "rootDir": ".",
    "outDir": "../lib"
  }
}
// tsconfig.json
{
  "extends": "@1stg/tsconfig/node16"
}
// package.json
{
  "main": "lib/index.cjs"
}
 FAIL  test/basic.spec.ts [ test/basic.spec.ts ]
Error: parsing /Users/JounQin/Workspaces/GitHub/test/lib/index.cjs failed: SyntaxError: Unexpected token ''', "'use stric"... is not valid JSON
 ❯ node_modules/vite/dist/node/chunks/dep-R0I0XnyH.js:13998:10

Caused by: SyntaxError: Unexpected token ''', "'use stric"... is not valid JSON
 ❯ node_modules/vite/dist/node/chunks/dep-R0I0XnyH.js:13990:24

Reproduction

https://github.com/JounQin/test/tree/vitest_repo

Steps to reproduce

yarn && yarn test

System Info

System:
    OS: macOS 14.2
    CPU: (10) arm64 Apple M1 Max
    Memory: 15.73 GB / 64.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.10.0 - ~/Library/Caches/fnm_multishells/29289_1702804971977/bin/node
    Yarn: 4.0.2 - ~/Library/Caches/fnm_multishells/29289_1702804971977/bin/yarn
    npm: 10.2.3 - ~/Library/Caches/fnm_multishells/29289_1702804971977/bin/npm
    bun: 1.0.18 - /opt/homebrew/bin/bun
  Browsers:
    Brave Browser: 120.1.61.100
    Chrome: 120.0.6099.109
    Safari: 17.2

Used Package Manager

yarn

Logs

No response

Validations

@sapphi-red
Copy link
Member

This is a bug in tsconfck: dominikg/tsconfck#149

@sapphi-red sapphi-red added bug: upstream Bug in a dependency of Vite p3-minor-bug An edge case that only affects very specific usage (priority) labels Dec 19, 2023
JounQin added a commit to JounQin/vite that referenced this issue Jan 5, 2024
@JounQin JounQin mentioned this issue Jan 5, 2024
9 tasks
JounQin added a commit to JounQin/vite that referenced this issue Jan 5, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Jan 23, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug: upstream Bug in a dependency of Vite p3-minor-bug An edge case that only affects very specific usage (priority)
Projects
None yet
2 participants