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

feat: automatically read tsconfig paths by references #3882

Merged
merged 2 commits into from
Nov 1, 2024

Conversation

chenjiahan
Copy link
Member

Summary

Automatically read tsconfig paths by references.

  • tsconfig.json:
{
  "references": [
    {
      "path": "./tsconfig.app.json"
    }
  ],
  "include": []
}
  • tsconfig.app.json:
{
  "compilerOptions": {
    "paths": {
      "@/common/*": ["./src/common/*"]
    }
  },
  "include": ["src"]
}

Related Links

https://rspack.dev/config/resolve#resolvetsconfigreferences

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

Copy link

netlify bot commented Nov 1, 2024

Deploy Preview for rsbuild ready!

Name Link
🔨 Latest commit 6a95622
🔍 Latest deploy log https://app.netlify.com/sites/rsbuild/deploys/67249dfe06327f00081b6175
😎 Deploy Preview https://deploy-preview-3882--rsbuild.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 83 (🟢 up 11 from production)
Accessibility: 97 (no change from production)
Best Practices: 100 (no change from production)
SEO: 100 (no change from production)
PWA: 60 (no change from production)
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify site configuration.

@chenjiahan chenjiahan requested a review from SoonIter November 1, 2024 09:35
@SoonIter
Copy link
Member

SoonIter commented Nov 1, 2024

what if the user configures it like this

{
  "references": [
    {
      "path": "./tsconfig.app.json"
    },
    {
      "path": "./tsconfig.node.json"
    }
  ],
  "include": []
}
  • tsconfig.app.json
{
  "compilerOptions": {
    "paths": {
      "@/common/*": ["./src/app/common/*"]
    }
  },
  "include": ["src"]
}
  • "./tsconfig.node.json"
{
  "compilerOptions": {
    "paths": {
      "@/common/*": ["./src/node/common/*"]
    }
  },
  "include": ["src"]
}

@SoonIter
Copy link
Member

SoonIter commented Nov 1, 2024

what if the user configures it like this

😄 it will hit the first reference that hits "include"

@SoonIter
Copy link
Member

SoonIter commented Nov 1, 2024

how about adjusting our template like create-vite,

├── rsbuild.config.ts
├── tsconfig.json
 
├── tsconfig.app.json
├── tsconfig.app.tsbuildinfo
 
├── tsconfig.node.json
└── tsconfig.node.tsbuildinfo

and adding "build": "tsc -b && rsbuild build" 😂 (or typecheck in loadConfig)

@chenjiahan
Copy link
Member Author

how about adjusting our template like create-vite,

We can, but I prefer to keep the template simple at this stage, unless something forces us to split the tsconfig files.

adding "build": "tsc -b && rsbuild build"

I would prefer the opt-in `@rsbuild/plugin-type-check' instead of tsc..

@chenjiahan chenjiahan merged commit 842dd1e into main Nov 1, 2024
9 checks passed
@chenjiahan chenjiahan deleted the tsconfig_references_paths_1101 branch November 1, 2024 13:33
@chenjiahan chenjiahan mentioned this pull request Nov 2, 2024
@9aoy 9aoy mentioned this pull request Nov 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants