Skip to content

Version3.3.0: Add TS Support#5

Open
Icorcka wants to merge 3 commits into
vsych:masterfrom
Icorcka:version3.3.0/add-ts
Open

Version3.3.0: Add TS Support#5
Icorcka wants to merge 3 commits into
vsych:masterfrom
Icorcka:version3.3.0/add-ts

Conversation

@Icorcka
Copy link
Copy Markdown

@Icorcka Icorcka commented May 13, 2026

No description provided.

Copy link
Copy Markdown
Contributor

@sergey-sign sergey-sign left a comment

Choose a reason for hiding this comment

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

Blocking

The try/catch around require.resolve('@babel/preset-typescript') in lib/webpack.config.coffee only logs console.warn and continues — but the .tsx? webpack rule and the .ts/.tsx extensions are still registered. A project that enables typescript: true without installing the peer dep won't see a clear "missing peer dep" error; it will see a confusing parse error from @babel/preset-env when it hits the first type annotation, wrapped by thread-loader. Please fail fast (throw with the actionable message) or short-circuit both the rule and the extensions when resolution fails.

Should fix

  • prjPath = '' as a default in makeBabel is a foot-gun: require.resolve(..., { paths: [''] }) silently behaves as if paths weren't passed at all, masking the intent. Either require prjPath (no default) or fall back to a meaningful root.
  • Consider paths: [prjPath, __dirname] instead of [prjPath] — falling back to zeropack2's own install dir preserves the previous behavior as a safety net and makes the upgrade strictly non-breaking.
  • With svelte: true, typescript: true, the second if branch concatenates .ts/.tsx onto the svelte-reset list, so .cjsx is silently dropped. Either intentional and documented, or refactor into a single decision block.

Worth noting

  • typescript: ">=4.0.0" as a peer dependency is misleading — @babel/preset-typescript strips types without consulting the typescript package. Consider removing it or pinning a more meaningful floor.
  • No tests added. A small fixture-project build would catch the silent-failure case and the resolution path automatically.
  • tsconfig.json is not consumed at build time — paths aliases declared there won't translate to module resolution; users still need resolve.alias. Worth documenting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants