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

TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".ts" /path/to/project #877

Closed
Royceb opened this issue May 10, 2023 · 3 comments
Labels

Comments

@Royceb
Copy link

Royceb commented May 10, 2023

Description

Hello, getting a typescript error when starting a fresh app after using pnpm create vite-plugin-ssr.

Steps:

  1. pnpm create vite-plugin-ssr
    1a. Choose react-ts
  2. cd vite-ssr-project/
  3. pnpm install
  4. pnpm dev
➜  vite-ssr-project git:(main) ✗ pnpm dev

> @ dev /vite-ssr-project
> npm run server


> server
> ts-node ./server/index.ts

TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".ts" for /vite-ssr-project/server/index.ts
    at new NodeError (node:internal/errors:399:5)
    at Object.getFileProtocolModuleFormat [as file:] (node:internal/modules/esm/get_format:99:9)
    at defaultGetFormat (node:internal/modules/esm/get_format:139:38)
    at defaultLoad (node:internal/modules/esm/load:83:20)
    at nextLoad (node:internal/modules/esm/hooks:750:28)
    at load /vite-ssr-project/node_modules/.pnpm/[email protected]_@[email protected][email protected]/node_modules/ts-node/dist/child/child-loader.js:19:122)
    at nextLoad (node:internal/modules/esm/hooks:750:28)
    at Hooks.load (node:internal/modules/esm/hooks:382:26)
    at MessagePort.handleMessage (node:internal/modules/esm/worker:165:24)
    at [nodejs.internal.kHybridDispatch] (node:internal/event_target:762:20) {
  code: 'ERR_UNKNOWN_FILE_EXTENSION'
}
@brillout
Copy link
Member

It's a ts-node issue. Downgrade to Node.js 18 or use a workaround / another tool than ts-node.

@brillout brillout closed this as not planned Won't fix, can't repro, duplicate, stale May 10, 2023
@Royceb
Copy link
Author

Royceb commented May 10, 2023

Thank you!

@brillout
Copy link
Member

Boilerplates updated to use this workaround: b77acfd.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants