-
-
Notifications
You must be signed in to change notification settings - Fork 955
fix(build): remove tsconfig paths mapping and adjust bundle config #5052
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
✅ Deploy Preview for unocss ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
commit: |
|
Explicitly set externals indeed resolve the issue(deps' types will not inlined anymore), but according to docs, we don't have to set them and should just omit them. Here's a minimal repro, and the build output: > [email protected] build /Users/jungzl/Projects/local-unocss
> tsdown
ℹ tsdown v0.18.4 powered by rolldown v1.0.0-beta.57
ℹ config file: /Users/jungzl/Projects/local-unocss/tsdown.config.ts
ℹ [Dual] entry: src/webpack.ts, src/postcss.ts
ℹ [Dual] tsconfig: tsconfig.json
ℹ [ESM only] entry: src/index.ts, src/vite.ts, src/astro.ts, src/preset-uno.ts, src/preset-icons.ts, src/preset-attributify.ts, src/preset-tagify.ts, src/preset-web-fonts.ts, src/preset-typography.ts, src/preset-wind.ts, src/preset-mini.ts, src/preset-wind3.ts, src/preset-wind4.ts
ℹ [ESM only] tsconfig: tsconfig.json
ℹ Build start
ℹ Cleaning 35 files
ℹ [Dual] [CJS] dist/webpack.cjs 0.76 kB │ gzip: 0.37 kB
ℹ [Dual] [CJS] dist/postcss.cjs 0.28 kB │ gzip: 0.18 kB
ℹ [Dual] [CJS] dist/chunk-CbDLau6x.cjs 1.12 kB │ gzip: 0.54 kB
ℹ [Dual] [CJS] 3 files, total: 2.16 kB
ℹ [Dual] [CJS] dist/webpack.d.cts 0.26 kB │ gzip: 0.17 kB
ℹ [Dual] [CJS] dist/postcss.d.cts 0.06 kB │ gzip: 0.06 kB
ℹ [Dual] [CJS] 2 files, total: 0.32 kB
✔ [Dual] Build complete in 324ms
ℹ [Dual] [ESM] dist/webpack.mjs 0.32 kB │ gzip: 0.19 kB
ℹ [Dual] [ESM] dist/postcss.mjs 0.15 kB │ gzip: 0.11 kB
ℹ [Dual] [ESM] dist/webpack.d.mts 0.29 kB │ gzip: 0.19 kB
ℹ [Dual] [ESM] dist/postcss.d.mts 0.07 kB │ gzip: 0.07 kB
ℹ [Dual] [ESM] 4 files, total: 0.82 kB
✔ [Dual] Build complete in 325ms
ℹ [ESM only] [ESM] dist/index.mjs 1.21 kB │ gzip: 0.38 kB
ℹ [ESM only] [ESM] dist/vite.mjs 0.30 kB │ gzip: 0.19 kB
ℹ [ESM only] [ESM] dist/astro.mjs 0.29 kB │ gzip: 0.18 kB
ℹ [ESM only] [ESM] dist/preset-attributify.mjs 0.16 kB │ gzip: 0.10 kB
ℹ [ESM only] [ESM] dist/preset-typography.mjs 0.16 kB │ gzip: 0.10 kB
ℹ [ESM only] [ESM] dist/preset-web-fonts.mjs 0.15 kB │ gzip: 0.10 kB
ℹ [ESM only] [ESM] dist/preset-tagify.mjs 0.14 kB │ gzip: 0.09 kB
ℹ [ESM only] [ESM] dist/preset-icons.mjs 0.14 kB │ gzip: 0.09 kB
ℹ [ESM only] [ESM] dist/preset-wind3.mjs 0.14 kB │ gzip: 0.09 kB
ℹ [ESM only] [ESM] dist/preset-wind4.mjs 0.14 kB │ gzip: 0.09 kB
ℹ [ESM only] [ESM] dist/preset-mini.mjs 0.14 kB │ gzip: 0.09 kB
ℹ [ESM only] [ESM] dist/preset-wind.mjs 0.14 kB │ gzip: 0.09 kB
ℹ [ESM only] [ESM] dist/preset-uno.mjs 0.13 kB │ gzip: 0.09 kB
ℹ [ESM only] [ESM] dist/index.d.mts 1.57 kB │ gzip: 0.47 kB
ℹ [ESM only] [ESM] dist/vite.d.mts 0.31 kB │ gzip: 0.20 kB
ℹ [ESM only] [ESM] dist/astro.d.mts 0.30 kB │ gzip: 0.18 kB
ℹ [ESM only] [ESM] dist/preset-attributify.d.mts 0.16 kB │ gzip: 0.09 kB
ℹ [ESM only] [ESM] dist/preset-typography.d.mts 0.16 kB │ gzip: 0.09 kB
ℹ [ESM only] [ESM] dist/preset-web-fonts.d.mts 0.15 kB │ gzip: 0.10 kB
ℹ [ESM only] [ESM] dist/preset-tagify.d.mts 0.14 kB │ gzip: 0.09 kB
ℹ [ESM only] [ESM] dist/preset-icons.d.mts 0.14 kB │ gzip: 0.09 kB
ℹ [ESM only] [ESM] dist/preset-wind3.d.mts 0.14 kB │ gzip: 0.09 kB
ℹ [ESM only] [ESM] dist/preset-wind4.d.mts 0.14 kB │ gzip: 0.09 kB
ℹ [ESM only] [ESM] dist/preset-mini.d.mts 0.13 kB │ gzip: 0.09 kB
ℹ [ESM only] [ESM] dist/preset-wind.d.mts 0.13 kB │ gzip: 0.09 kB
ℹ [ESM only] [ESM] dist/preset-uno.d.mts 0.13 kB │ gzip: 0.09 kB
ℹ [ESM only] [ESM] 26 files, total: 6.85 kB
✔ [ESM only] Build complete in 683ms
✔ [ESM only] [attw] No problems found (561ms)
which is close to <= 66.5.10 while in this monorepo if you omit externals, the build output will be: > [email protected] build /Users/jungzl/Projects/unocss/packages-presets/unocss
> tsdown
ℹ tsdown v0.18.3 powered by rolldown v1.0.0-beta.57
ℹ config file: /Users/jungzl/Projects/unocss/packages-presets/unocss/tsdown.config.ts
ℹ [Dual] entry: src/webpack.ts, src/postcss.ts
ℹ [Dual] target: node14.0.0
ℹ [Dual] tsconfig: ../../tsconfig.json
ℹ [ESM only] entry: src/index.ts, src/vite.ts, src/astro.ts, src/preset-uno.ts, src/preset-icons.ts, src/preset-attributify.ts, src/preset-tagify.ts, src/preset-web-fonts.ts, src/preset-typography.ts, src/preset-wind.ts, src/preset-mini.ts, src/preset-wind3.ts, src/preset-wind4.ts
ℹ [ESM only] target: node14.0.0
ℹ [ESM only] tsconfig: ../../tsconfig.json
ℹ Build start
ℹ Cleaning 40 files
ℹ [Dual] [CJS] dist/webpack.cjs 0.76 kB │ gzip: 0.37 kB
ℹ [Dual] [CJS] dist/postcss.cjs 0.28 kB │ gzip: 0.18 kB
ℹ [Dual] [CJS] dist/chunk-CbDLau6x.cjs 1.12 kB │ gzip: 0.54 kB
ℹ [Dual] [CJS] 3 files, total: 2.16 kB
ℹ [Dual] [CJS] dist/postcss.d.cts 0.78 kB │ gzip: 0.41 kB
ℹ [Dual] [CJS] dist/webpack.d.cts 0.78 kB │ gzip: 0.36 kB
ℹ [Dual] [CJS] dist/types-BJXpjqVF.d.cts 30.60 kB │ gzip: 8.05 kB
ℹ [Dual] [CJS] 3 files, total: 32.16 kB
✔ [Dual] Build complete in 1131ms
ℹ [Dual] [ESM] dist/webpack.mjs 0.32 kB │ gzip: 0.19 kB
ℹ [Dual] [ESM] dist/postcss.mjs 0.15 kB │ gzip: 0.11 kB
ℹ [Dual] [ESM] dist/postcss.d.mts 0.81 kB │ gzip: 0.41 kB
ℹ [Dual] [ESM] dist/webpack.d.mts 0.78 kB │ gzip: 0.36 kB
ℹ [Dual] [ESM] dist/types-mY0m3B5A.d.mts 30.60 kB │ gzip: 8.05 kB
ℹ [Dual] [ESM] 5 files, total: 32.65 kB
✔ [Dual] Build complete in 1132ms
ℹ [ESM only] [ESM] dist/index.mjs 1.21 kB │ gzip: 0.38 kB
ℹ [ESM only] [ESM] dist/vite.mjs 0.30 kB │ gzip: 0.19 kB
ℹ [ESM only] [ESM] dist/astro.mjs 0.29 kB │ gzip: 0.18 kB
ℹ [ESM only] [ESM] dist/preset-attributify.mjs 0.16 kB │ gzip: 0.10 kB
ℹ [ESM only] [ESM] dist/preset-typography.mjs 0.16 kB │ gzip: 0.10 kB
ℹ [ESM only] [ESM] dist/preset-web-fonts.mjs 0.15 kB │ gzip: 0.10 kB
ℹ [ESM only] [ESM] dist/preset-tagify.mjs 0.14 kB │ gzip: 0.09 kB
ℹ [ESM only] [ESM] dist/preset-icons.mjs 0.14 kB │ gzip: 0.09 kB
ℹ [ESM only] [ESM] dist/preset-wind3.mjs 0.14 kB │ gzip: 0.09 kB
ℹ [ESM only] [ESM] dist/preset-wind4.mjs 0.14 kB │ gzip: 0.09 kB
ℹ [ESM only] [ESM] dist/preset-mini.mjs 0.14 kB │ gzip: 0.09 kB
ℹ [ESM only] [ESM] dist/preset-wind.mjs 0.14 kB │ gzip: 0.09 kB
ℹ [ESM only] [ESM] dist/preset-uno.mjs 0.13 kB │ gzip: 0.09 kB
ℹ [ESM only] [ESM] dist/preset-wind4.d.mts 19.58 kB │ gzip: 2.12 kB
ℹ [ESM only] [ESM] dist/preset-mini.d.mts 15.42 kB │ gzip: 1.93 kB
ℹ [ESM only] [ESM] dist/index.d.mts 6.39 kB │ gzip: 1.98 kB
ℹ [ESM only] [ESM] dist/astro.d.mts 0.86 kB │ gzip: 0.42 kB
ℹ [ESM only] [ESM] dist/preset-attributify.d.mts 0.86 kB │ gzip: 0.31 kB
ℹ [ESM only] [ESM] dist/vite.d.mts 0.67 kB │ gzip: 0.32 kB
ℹ [ESM only] [ESM] dist/preset-wind3.d.mts 0.62 kB │ gzip: 0.30 kB
ℹ [ESM only] [ESM] dist/preset-web-fonts.d.mts 0.50 kB │ gzip: 0.23 kB
ℹ [ESM only] [ESM] dist/preset-typography.d.mts 0.42 kB │ gzip: 0.19 kB
ℹ [ESM only] [ESM] dist/preset-icons.d.mts 0.42 kB │ gzip: 0.21 kB
ℹ [ESM only] [ESM] dist/preset-tagify.d.mts 0.27 kB │ gzip: 0.17 kB
ℹ [ESM only] [ESM] dist/preset-wind.d.mts 0.17 kB │ gzip: 0.13 kB
ℹ [ESM only] [ESM] dist/preset-uno.d.mts 0.16 kB │ gzip: 0.13 kB
ℹ [ESM only] [ESM] dist/split-jWX3Cw_P.d.mts 76.55 kB │ gzip: 19.15 kB
ℹ [ESM only] [ESM] dist/colors-BYdFgHBl.d.mts 5.81 kB │ gzip: 0.45 kB
ℹ [ESM only] [ESM] dist/index-CrRqJ4Yv.d.mts 3.45 kB │ gzip: 1.16 kB
ℹ [ESM only] [ESM] 29 files, total: 135.40 kB
✔ [ESM only] Build complete in 1353ms
WARN [ESM only] [attw] problems found:
🎭 False export default
Types: /node_modules/unocss/dist/webpack.d.cts | Implementation: /node_modules/unocss/dist/webpack.cjsand if you run I think it is a bug in tsdown. |
|
@Jungzl Please provide more background. No idea about your expectation. |
|
if I set config like below(which is the same as repro above): tsdown.config.tsimport { defineConfig } from 'tsdown'
export default defineConfig([
{
name: 'Dual',
entry: [
'src/webpack.ts',
'src/postcss.ts',
],
clean: true,
dts: true,
format: ['esm', 'cjs'],
- external: [
- '@unocss/webpack',
- '@unocss/postcss',
- ],
failOnWarn: false,
},
{
name: 'ESM only',
entry: [
'src/index.ts',
'src/vite.ts',
'src/astro.ts',
'src/preset-uno.ts',
'src/preset-icons.ts',
'src/preset-attributify.ts',
'src/preset-tagify.ts',
'src/preset-web-fonts.ts',
'src/preset-typography.ts',
'src/preset-wind.ts',
'src/preset-mini.ts',
'src/preset-wind3.ts',
'src/preset-wind4.ts',
],
clean: false,
dts: true,
- external: [
- '@unocss/core',
- '@unocss/astro',
- '@unocss/postcss',
- '@unocss/preset-attributify',
- '@unocss/preset-icons',
- '@unocss/preset-mini',
- '@unocss/preset-tagify',
- '@unocss/preset-typography',
- '@unocss/preset-uno',
- '@unocss/preset-web-fonts',
- '@unocss/preset-wind',
- '@unocss/preset-wind3',
- '@unocss/preset-wind4',
- '@unocss/transformer-attributify-jsx',
- '@unocss/transformer-compile-class',
- '@unocss/transformer-directives',
- '@unocss/transformer-variant-group',
- '@unocss/vite',
- ],
attw: {
profile: 'esm-only',
},
},
])deps will not be bundled into dist by default, but dts generated from deps are not omitted.
the right is the expected output. so now we have to explicitly set all related deps on external option, I think tsdown should omit these types as well or maybe I missed some configuration option. @sxzz |
|
So, you mean these dependencies are inline-bundled in unocss repo, but externalized in your reproduction repo, right? |
Only the dts are inlined, while the deps are not. |
|
In your reproduction, all deps are externalized in both js and dts // dist/index.js
import presetAttributify from "@unocss/preset-attributify";
import presetIcons from "@unocss/preset-icons";
import presetMini from "@unocss/preset-mini";
import presetTagify from "@unocss/preset-tagify";
import presetTypography from "@unocss/preset-typography";
import presetUno from "@unocss/preset-uno";
import presetWebFonts from "@unocss/preset-web-fonts";
import presetWind from "@unocss/preset-wind";
import presetWind3 from "@unocss/preset-wind3";
import presetWind4 from "@unocss/preset-wind4";
import transformerAttributifyJsx from "@unocss/transformer-attributify-jsx";
import transformerCompileClass from "@unocss/transformer-compile-class";
import transformerDirectives from "@unocss/transformer-directives";
import transformerVariantGroup from "@unocss/transformer-variant-group";
export * from "@unocss/core"
//#region src/index.ts
/**
* Define UnoCSS config
*/
function defineConfig(config) {
return config;
}
//#endregion
export { defineConfig, presetAttributify, presetIcons, presetMini, presetTagify, presetTypography, presetUno, presetWebFonts, presetWind, presetWind3, presetWind4, transformerAttributifyJsx, transformerCompileClass, transformerDirectives, transformerVariantGroup };// dist/index.d.ts
import { UserConfig } from "@unocss/core";
import presetAttributify from "@unocss/preset-attributify";
import presetIcons from "@unocss/preset-icons";
import presetMini, { Theme as PresetMiniTheme } from "@unocss/preset-mini";
import presetTagify from "@unocss/preset-tagify";
import presetTypography from "@unocss/preset-typography";
import presetUno, { Theme, Theme as PresetUnoTheme } from "@unocss/preset-uno";
import presetWebFonts from "@unocss/preset-web-fonts";
import presetWind, { Theme as PresetWindTheme } from "@unocss/preset-wind";
import presetWind3, { Theme as PresetWind3Theme } from "@unocss/preset-wind3";
import presetWind4, { Theme as PresetWind4Theme } from "@unocss/preset-wind4";
import transformerAttributifyJsx from "@unocss/transformer-attributify-jsx";
import transformerCompileClass from "@unocss/transformer-compile-class";
import transformerDirectives from "@unocss/transformer-directives";
import transformerVariantGroup from "@unocss/transformer-variant-group";
export * from "@unocss/core";
//#region src/index.d.ts
/**
* Define UnoCSS config
*/
declare function defineConfig<T extends object = Theme>(config: UserConfig<T>): UserConfig<T>;
//#endregion
export { type PresetMiniTheme, type PresetUnoTheme, type PresetWind3Theme, type PresetWind4Theme, type PresetWindTheme, defineConfig, presetAttributify, presetIcons, presetMini, presetTagify, presetTypography, presetUno, presetWebFonts, presetWind, presetWind3, presetWind4, transformerAttributifyJsx, transformerCompileClass, transformerDirectives, transformerVariantGroup }; |
|
it works fine in single repo but not in monorepo. |
|
OK, I see. Your reproduction actually misled me. A reproduction is meant to demonstrate the bug, not to show a working example... |
|
oops, sorry for the confusion. |
"@unocss/core"|
uhh...docs & playground build failed, I need to investigate further. |
|
looks like mentioned in #5049 |




fix: #5025 , #5050 , #5056