When is tsc not enough? #8496
-
SummaryI love the new additions to the docs. That said, it feels that there may be places where the best practices in the docs are misaligned with the state of the examples in the repo. For example, the docs state in the Best Practices section for TypeScript:
However, in the Some internal packages, such as the import { defineConfig, type Options } from "tsup";
export default defineConfig((options: Options) => ({
entry: ["./src/index.tsx"],
format: ["cjs", "esm"],
dts: true,
external: ["react"],
banner: {
js: "'use client'",
},
...options,
})); I actually don't know if that is flat out impossible with Can someone explain why that would be the case for the import { defineConfig, type Options } from "tsup";
export default defineConfig((options: Options) => ({
entryPoints: ["src/index.ts"],
clean: true,
dts: true,
format: ["cjs"],
...options,
})); Is it just that the examples are lagging behind the philosophy or am I missing something? Additional information
ExampleNo response |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
The short answer is: use a bundler when you need ... bundling :) A bundler does a bunch of things, such as:
|
Beta Was this translation helpful? Give feedback.
-
Hello, @wujekbogdan In the Turbo documentation, it states here:
Based on this, I understand that when another application package consumes the internal package, there is no need to worry about polyfilling, downleveling, or other concerns (doesn’t this include browserlists as well?).
So, does this mean internal packages used by the application package don't need to consider the above points? |
Beta Was this translation helpful? Give feedback.
The short answer is: use a bundler when you need ... bundling :)
A bundler does a bunch of things, such as:
*.js
output file, whiletsc
emits as many*.js
files as the number of*.ts
files it compiles.*.graphql
or*.css
, with custom loaders.__dirname
shim for ESM.tsc
only compiles to a predefined target (e.g., ES2022).