Cannot able to deploy due to TS AllowTsExtension enabled

12:18:49 PM: Netlify Build
12:18:49 PM: ────────────────────────────────────────────────────────────────
12:18:49 PM: ​
12:18:49 PM: ❯ Version
12:18:49 PM: @netlify/build 29.37.2
12:18:49 PM: ​
12:18:49 PM: ❯ Flags
12:18:49 PM: baseRelDir: true
12:18:49 PM: buildId: 6606642bf1b0c6000829028c
12:18:49 PM: deployId: 6606642bf1b0c6000829028e
12:18:49 PM: ​
12:18:49 PM: ❯ Current directory
12:18:49 PM: /opt/build/repo
12:18:49 PM: ​
12:18:49 PM: ❯ Config file
12:18:49 PM: No config file was defined: using default values.
12:18:49 PM: ​
12:18:49 PM: ❯ Context
12:18:49 PM: production
12:18:49 PM: ​
12:18:49 PM: Build command from Netlify app
12:18:49 PM: ────────────────────────────────────────────────────────────────
12:18:49 PM: ​
12:18:49 PM: $ CI= npm run build
12:18:49 PM: > org_chart@0.0.0 build
12:18:49 PM: > tsc && vite build
12:18:50 PM: Failed during stage “building site”: Build script returned non-zero exit code: 2
12:18:50 PM: src/main.tsx(3,17): error TS5097: An import path can only end with a “.tsx” extension when “allowImportingTsExtensions” is enabled.
12:18:50 PM: ​
12:18:50 PM: “build.command” failed
12:18:50 PM: ────────────────────────────────────────────────────────────────
12:18:50 PM: ​
12:18:50 PM: Error message
12:18:50 PM: Command failed with exit code 2: CI= npm run build (Search results for '"non-zero exit code: 2"' - Netlify Support Forums)
12:18:50 PM: ​
12:18:50 PM: Error location
12:18:50 PM: In Build command from Netlify app:
12:18:50 PM: CI= npm run build
12:18:50 PM: ​
12:18:50 PM: Resolved config
12:18:50 PM: build:
12:18:50 PM: command: CI= npm run build
12:18:50 PM: commandOrigin: ui
12:18:50 PM: environment:
12:18:50 PM: - CI
12:18:50 PM: publish: /opt/build/repo/dist
12:18:50 PM: publishOrigin: ui
12:18:50 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
12:18:50 PM: Failing build: Failed to build site
12:18:51 PM: Finished processing build request in 23.139s

This is nothing to do with Netlify. This is your project and the configuration you’ve used.

Read Vite documentation

quote

If you are using TypeScript, enable "moduleResolution": "bundler" and "allowImportingTsExtensions": true in your tsconfig.json’s compilerOptions to use .ts and .tsx extensions directly in your code.

if but i but the above changes,

“moduleResolution”: “node”, can able to set to onlt node, other than node values, code editor shows error.

please help me to fix.

This is not a Netlify issue. Please open a thread on some other developer forums.