feat: reduce handling of typescript in this plugin - #24
Open
barelyhuman wants to merge 7 commits into
Open
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR refactors the rollup plugin to use esbuild for TypeScript/JSX transformations instead of the previous rollup + @rollup/plugin-typescript + babel approach. The changes streamline the build process by leveraging esbuild's faster performance and built-in JSX/TypeScript support.
Key changes:
- Replaced rollup-based TypeScript compilation with esbuild's
transformandbuildAPIs - Removed deprecated tsconfig options from the default configuration
- Simplified the playground's rollup configuration to remove babel and node-resolve plugins
- Marked tsconfig options as deprecated in type definitions
Reviewed Changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| rollup.js | Replaced rollup + TypeScript + babel pipeline with esbuild transform/build calls for both source transformation and client bundle generation |
| playground/rollup.config.js | Removed babel and node-resolve plugins, simplified TypeScript configuration to preserve JSX |
| lib/types.d.ts | Marked tsconfig options as deprecated with JSDoc comments |
| .github/workflows/test.yml | Renamed workflow job from "format" to "test" |
Comments suppressed due to low confidence (5)
rollup.js:7
- The
nodeResolveimport is no longer used after switching to esbuild for bundling. This import should be removed.
const { nodeResolve } = require('@rollup/plugin-node-resolve')
rollup.js:8
- The
jsximport is no longer used after removing the rollup-based TypeScript compilation. This import should be removed.
const jsx = require('acorn-jsx')
rollup.js:9
- The
babelimport is no longer used after replacing babel with esbuild for JSX transformation. This import should be removed.
const { babel } = require('@rollup/plugin-babel')
rollup.js:10
- The
resolveTsConfigimport is no longer used after removing tsconfig-based compilation. This import should be removed.
const { resolveTsConfig } = require('./lib/typescript')
rollup.js:106
- The
autoLoadTypescriptPlugfunction is no longer used after removing the TypeScript plugin. This entire function should be removed.
function autoLoadTypescriptPlug() {
try {
const plug = require('@rollup/plugin-typescript')
if (plug) {
return plug.default
}
} catch (err) {
return () => ({
name: 'typescript',
})
}
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
in cases like `bun` the `.transform` doesn't exist on the `builder` sub method
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The initial reason for adding a typescript plugin internally was to allow users to provide a tsconfig for the server and one for the client since the client build is handled by the plugin.
Over different typescript configurations I realised that a lot of configurations end up causing the client build to be invalid because of the config being server focused and the expectation that the plugin would just handle it for the client which wasn't the intention of the
tsconfigfields and also wasn't documented (so mostly my fault)The other part is that the client build in most cases would end up needing the same kind of configuration so it's easier to just have it use the same config for each client build and so this PR removes the dependency on
rollup/plugin-typescriptand usesesbuildto handle normalisation of the AST and the also the client side builds.