Skip to content
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

rollup.dts.compilerOptions cannot work with declaration #428

Open
gweesin opened this issue Aug 16, 2024 · 1 comment
Open

rollup.dts.compilerOptions cannot work with declaration #428

gweesin opened this issue Aug 16, 2024 · 1 comment
Labels
bug Something isn't working dts

Comments

@gweesin
Copy link

gweesin commented Aug 16, 2024

Environment

node v18.19.1
pnpm v9.7.1

Reproduction

git clone [email protected]:gweesin/unbuild-issue.git

cd unbuild-issue

pnpm i

pnpm build

Describe the bug

run the reproduction, you can see dist/tsup/index.type.d.ts and dist/unbuild/index.type.d.ts

on tsup, the compilerOptions parameter is valid like this:

interface InterfaceA {
}
interface InterfaceB {
}

type TypeC = InterfaceA | InterfaceB;

export type { TypeC };

on unbuild, the compilerOptions parameter is invalid like this:

import { InterfaceA, InterfaceB } from '@/demo';
export type TypeC = InterfaceA | InterfaceB;

the build.config.ts file:

import {defineBuildConfig} from 'unbuild'

export default defineBuildConfig({
    entries: [
        {
            builder: 'mkdist',
            input: './types/',
            outDir: './dist/unbuild',
        }
    ],
    declaration: true,
    clean: true,
    rollup: {
        dts: {
            compilerOptions: {
                noEmitOnError: false,
                strict: false,
                alwaysStrict: false,
                skipLibCheck: true,
                skipDefaultLibCheck: true,
                paths: {
                    '@/*': ['./src/*'],
                }
            }
        }
    }
})

Additional context

No response

Logs

No response

@gweesin
Copy link
Author

gweesin commented Sep 19, 2024

While path mapping functions correctly in rollup-plugin-dts, I'm facing an issue with unbuild where it fails to resolve paths, even though the configuration matches the test case at:

https://github.com/Swatinem/rollup-plugin-dts/blob/9d11bbabc597f1226b320e316507e138900ea7d7/tests/testcases/custom-tsconfig/tsconfig.build.json#L5

@pi0 pi0 added the dts label Dec 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working dts
Projects
None yet
Development

No branches or pull requests

2 participants