Template: add rewriteRelativeImportExtensions to tsconfig.node.json

Open Beginner friendly
#781 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
1/5
Estimated time
Under an hour
Newbie friendliness
78/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Active
Tech stack
typescript, vite
Domain
build-system

Research direction

The change is a one-line addition to Coalesce.Starter.Vue.Web/tsconfig.node.json, where rewriteRelativeImportExtensions should sit beside the existing compiler options. Check that the root tsconfig.json still type-checks with vue-tsc and that the vite.config.ts import of ./build/vitepress-docs resolves without a warning. Done when the TS6310 error no longer appears and the config loads under configLoader: 'native'.

Written by the indexing model from the issue text.

Description

Vite warns that a relative import without a file extension in vite.config.ts won't load under configLoader: 'native', which is planned to become the default in a future major:

(!) Your Vite config uses features that are unsupported by `configLoader: 'native'`, ...
  - import "./build/vitepress-docs" without a file extension (vite.config.ts:14:31). Add the file extension

The fix is to write ./build/vitepress-docs.ts. To type-check that import, tsconfig.node.json needs either allowImportingTsExtensions or rewriteRelativeImportExtensions. allowImportingTsExtensions requires noEmit, and because the root tsconfig.json references tsconfig.node.json with composite: true, that fails vue-tsc with TS6310 ("Referenced project ... may not disable emit"). rewriteRelativeImportExtensions: true has no such requirement.

The template's vite.config.ts has no relative imports today, but the first one a project adds runs into this. Adding "rewriteRelativeImportExtensions": true to Coalesce.Starter.Vue.Web/tsconfig.node.json would let projects follow Vite's advice without hitting TS6310.

Dominant language
C#
Stars
81
Forks
24
PR merge metrics
No merged PRs in 30d

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from IntelliTect/Coalesce

All issues in IntelliTect/Coalesce

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.