GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — Determining Module Migration and Shipping Strategy · Issue #49037 · microsoft/TypeScript Closed Labels DiscussionIssues which may not have code impactIssues which may not have code impactFix AvailableA PR has been opened for this issueA PR has been opened for this issue Milestone DescriptionThe work to get the TypeScript codebase over to modules still has a few open questions. There are a few high-level things we want to think about. We want to be able to maximize a few things:
What questions/problems does that leave us with? Internal Naming HazardsTypeScript defines its own entities that clash with those often defined globally (e.g.
Perhaps we'll have to create a lint rule here; however, at some point it would be nice to just drop our internal shims like Internal OrganizationWhile TypeScript under Module FormatToday, TypeScript ships CommonJS modules that also plop a global into scope named Do we want to continue supporting CommonJS targets? Do we want to ship both CommonJS and ECMAScript modules? Do we want to ship both? I think it feels obvious to say that we need to at least continue shipping CommonJS. TypeScript is so widely used, and we would be leaving a lot of users stranded if we did this now. Down the road, we could switch to ESM only, but for now it's not hard for us to ship both since we don't have dependencies. While feasible, it obviously diminishes the wins for reducing TypeScript's package size on npm, and we have to worry about divergences. If we ship both CJS and ESM, will we feel confident that they will behave identically? BundlingWe would prefer to ship fewer files with TypeScript to avoid resolution time if possible. We also don't want to worry about "deep import" problems if we end up supporting older versions of Node.js. All signs here lead to bundling. TypeScript currently doesn't provide the capabilities to bundle a project. Instead, projects like Webpack, Rollup, esbuild, swc, Rome, Parcel, and more have filled in the gap here. Bundling for TestingDo we want to bundle ourselves when running tests? If so, do we want our bundler to perform the downlevel compilation on TypeScript itself, or do we want the bundler to run on TypeScript's self-produced output? Do we want to use the same bundler between development and production? At each step, we risk some amount of divergence. Bundling can possibly lead to different semantics compared to running modules directly. Running two different bundlers between dev and prod can lead to diferent semantics. Using a bundler that downlevel-compiles can lead to different semantics from running TypeScript's output code. We could make our development and production builds identical (they are today anyway, and this makes things nicely predictable). To do this, we would just have TypeScript produce emit, and have a bundler run on the output (which means it's just one extra step). This has the nice benefit of not worrying about CI contexts vs. local contexts, etc. You can produce the same build of TypeScript no matter where you are, no matter what your system environment variables are. What's the opportunity cost? Well tools like esbuild are fast! You could imagine starting to run tests before the LKG (last-known-good version) of TypeScript has even finished type-checking itself. Declaration BundlingIt's not enough to say that we want to ship bundled JavaScript files; any Reacted by electron-space, razh, jiaSheng, John Reilly, Rob Palmer, ExE Boss, Emmanuel Meric de Bellefon, Maxime Richard and roottool Reacted by ExE Boss and Ghalib Ansari Reacted by ExE Boss and electron-space Reacted by ExE Boss and clearfram3 Reacted by Martin Johns and John Reilly Activity
MetadataMetadataAssigneesLabelsDiscussionIssues which may not have code impactIssues which may not have code impactFix AvailableA PR has been opened for this issueA PR has been opened for this issue TypeProjectsMilestoneRelationshipsDevelopmentIssue actions |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |