-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
ts-node error on build attempt #1926
Comments
Hi, What I did to work around this was install pnpm add -Dw tsx
cd apps/www
pnpm tsx --tsconfig ./tsconfig.scripts.json ./scripts/build-registry.ts Please let me know if this works for you. If it does, I will open a PR suggesting the switch. |
@Gravy59 That seems to do the trick! Thank you |
…1977) This pull request resolves #1926 and prevents issues like it from happening in the future ## Rationale for this PR This PR changes the TypeScript execution package for use in scripts like `build:registry` from `ts-node` to `tsx`. This is because `ts-node` has many difficult quirks to work through (and is slow). In addition, it also has a difficult to understand error for newcomers that *is* reproducible. ### The ts-node error As shown in #1926, using `ts-node` (specifically in `build:registry`) results in this error: `Unknown file extension ".ts" for /ui/apps/www/scripts/build-registry.ts`. There are many issues in the `ts-node` repository documenting this problem: * TypeStrong/ts-node/issues/1062 * TypeStrong/ts-node/issues/2033 * TypeStrong/ts-node/issues/1997 Switching the typescript-in-node system to `tsx`, which uses esbuild under the hood, resolves this error. This PR shouldn't affect tests, representation, etc. and is merely a change of build tools. There is no urgent need to merge this. I accidentally deleted the head repository on #1937. That will not happen again.
…hadcn-ui#1977) This pull request resolves shadcn-ui#1926 and prevents issues like it from happening in the future ## Rationale for this PR This PR changes the TypeScript execution package for use in scripts like `build:registry` from `ts-node` to `tsx`. This is because `ts-node` has many difficult quirks to work through (and is slow). In addition, it also has a difficult to understand error for newcomers that *is* reproducible. ### The ts-node error As shown in shadcn-ui#1926, using `ts-node` (specifically in `build:registry`) results in this error: `Unknown file extension ".ts" for /ui/apps/www/scripts/build-registry.ts`. There are many issues in the `ts-node` repository documenting this problem: * TypeStrong/ts-node/issues/1062 * TypeStrong/ts-node/issues/2033 * TypeStrong/ts-node/issues/1997 Switching the typescript-in-node system to `tsx`, which uses esbuild under the hood, resolves this error. This PR shouldn't affect tests, representation, etc. and is merely a change of build tools. There is no urgent need to merge this. I accidentally deleted the head repository on shadcn-ui#1937. That will not happen again.
I was trying to build the registry locally with the latest pnpm version but kept running into the 'Unknown file extension ".ts"' for "build-registry.ts" error (even with the passed esm flag). Also reproduced easily when creating a codespace on the main repo.
Full output for pnpm build:registry (or main build)
The text was updated successfully, but these errors were encountered: