-
Notifications
You must be signed in to change notification settings - Fork 150
Pass tsconfig to esbuild for support of "paths" aliases
#705
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
Pass tsconfig to esbuild for support of "paths" aliases
#705
Conversation
Updates the workflow esbuild plugin to accept the `tsconfig` path so that esbuild utilizes the entire config for the features that esbuild supports natively (specifically `"paths"` config, but probably others as well).
🦋 Changeset detectedLatest commit: b08f6d7 The changes in this PR will be included in the next version bump. This PR includes changesets to release 10 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
📊 Benchmark Results
workflow with no steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Express | Next.js (Turbopack) | Nitro workflow with 1 step💻 Local Development
▲ Production (Vercel)
🔍 Observability: Express | Nitro | Next.js (Turbopack) workflow with 10 sequential steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Nitro | Express | Next.js (Turbopack) Promise.all with 10 concurrent steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Nitro | Express | Next.js (Turbopack) Promise.all with 25 concurrent steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Nitro | Express | Next.js (Turbopack) Promise.race with 10 concurrent steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Express | Nitro | Next.js (Turbopack) Promise.race with 25 concurrent steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Express | Nitro | Next.js (Turbopack) Stream Benchmarks (includes TTFB metrics)workflow with stream💻 Local Development
▲ Production (Vercel)
🔍 Observability: Next.js (Turbopack) | Nitro | Express SummaryFastest Framework by WorldWinner determined by most benchmark wins
Fastest World by FrameworkWinner determined by most benchmark wins
Column Definitions
Worlds:
|
🧪 E2E Test Results❌ Some tests failed Summary
❌ Failed Tests🌍 Community Worlds (12 failed)mongodb (1 failed):
redis (1 failed):
starter (9 failed):
turso (1 failed):
Details by Category✅ ▲ Vercel Production
✅ 💻 Local Development
✅ 📦 Local Production
✅ 🐘 Local Postgres
✅ 🪟 Windows
❌ 🌍 Community Worlds
|
This stack of pull requests is managed by Graphite. Learn more about stacking. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR refactors the workflow build system to simplify TypeScript path alias resolution by leveraging esbuild's native tsconfig option. Instead of manually extracting and passing baseUrl and paths separately, the builders now pass the tsconfigPath directly to esbuild, allowing it to handle path aliases natively. A new @repo/* alias is added to test cross-directory imports.
Key Changes
- Replaces separate
tsBaseUrlandtsPathsparameters with a singletsconfigPathparameter across all builder implementations - Updates esbuild configuration to use the
tsconfigoption for native path alias resolution - Removes path configuration from SWC plugin since esbuild now handles path resolution
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| workbench/nextjs-turbopack/tsconfig.json | Adds @repo/* path alias for testing cross-directory imports |
| lib/steps/paths-alias-test.ts | Creates test step function to verify path alias resolution (currently unused) |
| packages/sveltekit/src/builder.ts | Updates to pass tsconfigPath instead of tsBaseUrl and tsPaths |
| packages/next/src/builder.ts | Updates to pass tsconfigPath instead of tsBaseUrl and tsPaths |
| packages/builders/src/vercel-build-output-api.ts | Updates to pass tsconfigPath instead of tsBaseUrl and tsPaths; removes unused parameters from webhook function |
| packages/builders/src/swc-esbuild-plugin.ts | Removes tsPaths and tsBaseUrl from plugin options with explanatory comment |
| packages/builders/src/standalone.ts | Updates to pass tsconfigPath instead of tsBaseUrl and tsPaths |
| packages/builders/src/base-builder.ts | Adds tsconfigPath to tsconfig options; updates bundle methods to accept and use tsconfigPath with esbuild's tsconfig option |
| packages/astro/src/builder.ts | Updates to pass tsconfigPath instead of tsBaseUrl and tsPaths |
| .changeset/soft-pets-yawn.md | Documents the change for affected packages |
Comments suppressed due to low confidence (1)
packages/builders/src/base-builder.ts:92
- The
baseUrlandpathsproperties are still being parsed and returned from this method, but they are no longer used anywhere in the codebase after this refactoring. Consider removing these from the return type and simplifying the method to only returntsconfigPath, which would make the code cleaner and reduce unnecessary parsing work.
protected async getTsConfigOptions(): Promise<{
baseUrl?: string;
paths?: Record<string, string[]>;
tsconfigPath?: string;
}> {
const options: {
paths?: Record<string, string[]>;
baseUrl?: string;
tsconfigPath?: string;
} = {};
const cwd = this.config.workingDir || process.cwd();
const tsJsConfig = await findUp(['tsconfig.json', 'jsconfig.json'], {
cwd,
});
if (tsJsConfig) {
options.tsconfigPath = tsJsConfig;
try {
const rawJson = await readFile(tsJsConfig, 'utf8');
const parsed: null | {
compilerOptions?: {
paths?: Record<string, string[]> | undefined;
baseUrl?: string;
};
} = parse(rawJson) as any;
if (parsed) {
options.paths = parsed.compilerOptions?.paths;
if (parsed.compilerOptions?.baseUrl) {
options.baseUrl = resolve(cwd, parsed.compilerOptions.baseUrl);
} else {
options.baseUrl = cwd;
}
}
} catch (err) {
console.error(
`Failed to parse ${tsJsConfig} aliases might not apply properly`,
err
);
}
}
return options;
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
LFG! 🚀 |
|
🙏🏼 |

Updates the workflow esbuild plugin to accept the
tsconfigpath so that esbuild utilizes the entire config for the features that esbuild supports natively (specifically"paths"config, but probably others as well).This potentially fixes #419 and #697.