diff --git a/src/rollup.ts b/src/rollup.ts index 8d34f711..e07ed961 100644 --- a/src/rollup.ts +++ b/src/rollup.ts @@ -126,7 +126,7 @@ const getRollupConfig = async ( const ignoreFiles: Plugin = { name: 'tsup:ignore-files', load(id) { - if (/\.(css|vue|svelte)$/.test(id)) { + if (!/\.(js|cjs|mjs|jsx|ts|tsx|mts|json)$/.test(id)) { return '' } }, diff --git a/test/index.test.ts b/test/index.test.ts index 3aa9ec5d..33cb6665 100644 --- a/test/index.test.ts +++ b/test/index.test.ts @@ -779,3 +779,30 @@ test('multiple targets', async () => { expect(output).toMatchSnapshot() expect(outFiles).toEqual(['input.js']) }) + +test('dts only: ignore files', async () => { + const { outFiles } = await run( + getTestName(), + { + 'input.ts': ` + import './style.scss' + + export const a = 1 + `, + 'style.scss': ` + @keyframes gallery-loading-spinner { + 0% {} + } + `, + }, + { + entry: ['input.ts'], + flags: ['--dts-only'], + } + ) + expect(outFiles).toMatchInlineSnapshot(` + [ + "input.d.ts", + ] + `) +})