Skip to content

feat(template): use moduleResolution: bundler - #4175

Merged
erickzhao merged 6 commits into
nextfrom
module-upgrades
Mar 20, 2026
Merged

feat(template): use moduleResolution: bundler#4175
erickzhao merged 6 commits into
nextfrom
module-upgrades

Conversation

@erickzhao

@erickzhao erickzhao commented Mar 18, 2026

Copy link
Copy Markdown
Member

Description

ref #4082 (comment)

In our TypeScript templates, applies module: preserve and moduleResolution: bundler.

Vite-specific changes

  • This PR required a change in the Vite plugin to properly export forge-vite-env.d.ts so that it could be consumed by the types field in tsconfig.json.
  • The above change means that we no longer need to create a separate forge.env.d.ts in the template.

BaseTemplate initialization changes

  • This is not strictly necessary for this PR. Feel free to force me to split it off.
  • BaseTemplate now merges all package.json fields from the tmpl folder. Effectively, this makes it more intuitive to pass template-specific configuration (instead of writing static strings into the package.json via JavaScript).

Typechecker tests

I added a new tsc --noEmit script into each TypeScript template. This is used in a new test that validates that all the types are happy. :)

Testing

  • Added the aforementioned typechecker tests
  • I iterated on this solution by testing with yarn patch in a sample Vite app: tinyspeck/sleuth@fd24c7b

@erickzhao erickzhao changed the title chore(template): TS compilerOptions upgrades feat(template): use moduleResolution: bundler in tsconfig.json Mar 19, 2026
@erickzhao erickzhao added the next label Mar 19, 2026
@erickzhao
erickzhao marked this pull request as ready for review March 19, 2026 23:27
@erickzhao
erickzhao requested a review from a team as a code owner March 19, 2026 23:27
@erickzhao erickzhao changed the title feat(template): use moduleResolution: bundler in tsconfig.json feat(template): use moduleResolution: bundler Mar 20, 2026

@BlackHole1 BlackHole1 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@erickzhao
erickzhao merged commit 12dabeb into next Mar 20, 2026
17 checks passed
@erickzhao
erickzhao deleted the module-upgrades branch March 20, 2026 17:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants