diff --git a/src/cli-main.ts b/src/cli-main.ts index 21944395..0ae381b7 100644 --- a/src/cli-main.ts +++ b/src/cli-main.ts @@ -79,6 +79,7 @@ export async function main(options: Options = {}) { default: 'node', }) .option('--loader ', 'Specify the loader for a file extension') + .option('--tsconfig ', 'Use a custom tsconfig') .option('--config ', 'Use a custom config file') .option('--no-config', 'Disable config file') .option('--shims', 'Enable cjs and esm shims') diff --git a/test/index.test.ts b/test/index.test.ts index e30ae854..9e426547 100644 --- a/test/index.test.ts +++ b/test/index.test.ts @@ -439,6 +439,21 @@ test('onSuccess', async () => { expect(logs.includes("world")).toEqual(true) }) +test('custom tsconfig', async () => { + await run( + getTestName(), + { + 'input.ts': `export const foo = 'foo'`, + 'tsconfig.build.json': `{ + "compilerOptions": { + "baseUrl":"." + } + }`, + }, + { flags: ['--tsconfig', 'tsconfig.build.json'] } + ) +}) + test('support baseUrl and paths in tsconfig.json', async () => { const { getFileContent } = await run(getTestName(), { 'input.ts': `export * from '@/foo'`,