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

Having compilerOptions.composite set fails to build #304

Open
moltar opened this issue Aug 21, 2023 · 2 comments · May be fixed by #504
Open

Having compilerOptions.composite set fails to build #304

moltar opened this issue Aug 21, 2023 · 2 comments · May be fixed by #504
Labels

Comments

@moltar
Copy link

moltar commented Aug 21, 2023

Environment

Node v18.12.1
PNPM Workspace v8

Reproduction

This is not super obvious, and I can provide a repro on demand if this is a new and/or unknown scenario.

Describe the bug

  1. Working with an PNPM workspace.
  2. Using TypeScript references.
  3. Have a project that sets composite: true (it is being references by another)
  4. When running unbuild get an error.

Additional context

The files are listed in includes.

Removing the composite flag makes the problem go away and build works fine.

Same problem and solution are described on SO (not for unbuild in particular): https://stackoverflow.com/a/70964056/1566758

Full tsconfig.json
{
  "compilerOptions": {
    "rootDir": "src",
    "outDir": "lib",
    "alwaysStrict": true,
    "declaration": true,
    "esModuleInterop": true,
    "experimentalDecorators": true,
    "inlineSourceMap": true,
    "inlineSources": true,
    "lib": [
      "es2019"
    ],
    "module": "CommonJS",
    "noEmitOnError": true,
    "noFallthroughCasesInSwitch": true,
    "noImplicitAny": true,
    "noImplicitReturns": true,
    "noImplicitThis": true,
    "noUnusedLocals": true,
    "noUnusedParameters": true,
    "resolveJsonModule": true,
    "strict": true,
    "strictNullChecks": true,
    "strictPropertyInitialization": true,
    "stripInternal": true,
    "target": "ES2019",
    "incremental": true,
    "tsBuildInfoFile": "tsconfig",
    "skipLibCheck": true,
    "declarationMap": true,
    "emitDeclarationOnly": true
  },
  "include": [
    "src/**/*.ts"
  ],
  "exclude": []
}
Diff that fixes the problem
diff --git a/packages/projen-jest-swc/tsconfig.json b/packages/projen-jest-swc/tsconfig.json
index 302b209..ffabb8e 100644
--- a/packages/projen-jest-swc/tsconfig.json
+++ b/packages/projen-jest-swc/tsconfig.json
@@ -29,7 +29,6 @@
     "incremental": true,
     "tsBuildInfoFile": "tsconfig",
     "skipLibCheck": true,
-    "composite": true,
     "declarationMap": true,
     "emitDeclarationOnly": true
   },

Logs

error TS6307: File '/foo/packages/package-a/src/index.ts' is not listed within the file list of project ''. Projects must list all files or use an 'include' pattern.
  The file is in the program because:
    Root file specified for compilation
src/index.ts(1,15): error TS6307: File '/foo/packages/package-a/src/jest-swc.ts' is not listed within the file list of project ''. Projects must list all files or use an 'include' pattern.
@moltar
Copy link
Author

moltar commented Aug 22, 2023

@kazupon
Copy link

kazupon commented Mar 14, 2024

you can work-around the below rollup.dts options:

import { defineBuildConfig } from 'unbuild';

export default defineBuildConfig({
  // ...
  rollup: {
    dts: {
      compilerOptions: { composite: false }
    }
  },
  // ...
});

recently, rollup-plugin-dts issue has been updated
Swatinem/rollup-plugin-dts#127 (comment)

@pi0 pi0 added the dts label Dec 27, 2024
@kricsleo kricsleo linked a pull request Feb 8, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants