modern.js
modern.js copied to clipboard
[Bug]: module-tools ignores extended tsconfig.json
Version
System:
OS: macOS 14.2.1
CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
Memory: 342.68 MB / 32.00 GB
Shell: 5.9 - /bin/zsh
npmPackages:
@modern-js/eslint-config: 2.46.1 => 2.46.1
@modern-js/module-tools: 2.46.1 => 2.46.1
Details
Hi there, I am getting an issue about tsconfig resolution in module-tools. The document says if emitDecoratorMetadata
is set to true in tsconfig.json
, module-tools will invoke swc to transpile source code instead of directly bundling with esbuild.
But I noticed that if module-tools depends a tsconfig.json
file which is extending from another tsconfig.json
, module-tools will ignore the extended tsconfig.json (however dts generation will respect both), thus causes the output bundle being unexpected. As I dived into the source code of module-tools, I've noticed that it only parses the direct tsconfig.json
file.
Is there any chance we can support parse extended tsconfig, since extending tsconfig.json
can be useful (for example, in a monorepo project)? I tried to fix this in this PR: https://github.com/web-infra-dev/modern.js/pull/5427 , but since I'm new to this project, there may be mistakes for my implementation, so it would be appreciated if you can fix this or give me some advice XD
Reproduce link
https://github.com/kirainmoe/module-tsconfig-extends-resolution
Reproduce Steps
- execute
pnpm i
- execute
pnpm build
- check dist output,
_ts_metadata('design:*')
is missing from output js (even thoughemitDecoratorMetadata
is set intsconfig.base.json
) - modify
tsconfig.json
, uncommentemitDecoratorMetadata
andexperimentalDecorators
- execute
pnpm build
- check dist output,
_ts_metadata('design:*')
is present (work as expected)