huozhi / bunchee

Zero config bundler for ECMAScript and TypeScript packages
https://npmjs.com/bunchee
948 stars 29 forks source link

build error on monorepo #425

Closed himself65 closed 10 months ago

himself65 commented 10 months ago
git clone https://github.com/run-llama/LlamaIndexTS
cd ./xxx
cd packages/core
pnpm run install
# patch diff
pnpm run build
Subject: [PATCH] fix: error when running examples
---
Index: packages/core/tsconfig.json
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/packages/core/tsconfig.json b/packages/core/tsconfig.json
--- a/packages/core/tsconfig.json   (revision 8bf0a41926406e312f03f58448045c901b63a95c)
+++ b/packages/core/tsconfig.json   (date 1706032783792)
@@ -1,4 +1,5 @@
 {
+  "extends": "../../tsconfig.json",
   "compilerOptions": {
     "rootDir": ".",
     "outDir": "./lib/",
/Users/himself65/Library/Caches/fnm_multishells/79550_1705975625285/bin/pnpm run build

> llamaindex@0.0.48 build /Users/himself65/Code/LlamaIndexTS/packages/core
> bunchee

src/index.ts(1,15): error TS6307: File '/Users/himself65/Code/LlamaIndexTS/packages/core/src/ChatHistory.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:
    Imported via "./ChatHistory" from file '/Users/himself65/Code/LlamaIndexTS/packages/core/src/index.ts'
    Imported via "../../ChatHistory" from file '/Users/himself65/Code/LlamaIndexTS/packages/core/src/engines/chat/CondenseQuestionChatEngine.ts'
    Imported via "../../ChatHistory" from file '/Users/himself65/Code/LlamaIndexTS/packages/core/src/engines/chat/types.ts'
    Imported via "../../ChatHistory" from file '/Users/himself65/Code/LlamaIndexTS/packages/core/src/engines/chat/ContextChatEngine.ts'
    Imported via "../../ChatHistory" from file '/Users/himself65/Code/LlamaIndexTS/packages/core/src/engines/chat/SimpleChatEngine.ts'
src/index.ts(17,15): error TS6307: File '/Users/himself65/Code/LlamaIndexTS/packages/core/src/engines/chat/index.ts' is not listed within the file list of project ''. Projects must list all files or use an 'include' pattern.
src/index.ts(18,15): error TS6307: File '/Users/himself65/Code/LlamaIndexTS/packages/core/src/extractors/index.ts' is not listed within the file list of project ''. Projects must list all files or use an 'include' pattern.
src/index.ts(19,15): error TS6307: File '/Users/himself65/Code/LlamaIndexTS/packages/core/src/indices/index.ts' is not listed within the file list of project ''. Projects must list all files or use an 'include' pattern.
src/index.ts(23,15): error TS6307: File '/Users/himself65/Code/LlamaIndexTS/packages/core/src/readers/AssemblyAI.ts' is not listed within the file list of project ''. Projects must list all files or use an 'include' pattern.
src/index.ts(24,15): error TS6307: File '/Users/himself65/Code/LlamaIndexTS/packages/core/src/readers/CSVReader.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:
    Imported via "./readers/CSVReader" from file '/Users/himself65/Code/LlamaIndexTS/packages/core/src/index.ts'
    Imported via "./CSVReader" from file '/Users/himself65/Code/LlamaIndexTS/packages/core/src/readers/SimpleDirectoryReader.ts'
src/index.ts(25,15): error TS6307: File '/Users/himself65/Code/LlamaIndexTS/packages/core/src/readers/DocxReader.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:
    Imported via "./readers/DocxReader" from file '/Users/himself65/Code/LlamaIndexTS/packages/core/src/index.ts'
    Imported via "./DocxReader" from file '/Users/himself65/Code/LlamaIndexTS/packages/core/src/readers/SimpleDirectoryReader.ts'
src/index.ts(26,15): error TS6307: File '/Users/himself65/Code/LlamaIndexTS/packages/core/src/readers/HTMLReader.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:
    Imported via "./readers/HTMLReader" from file '/Users/himself65/Code/LlamaIndexTS/packages/core/src/index.ts'
    Imported via "./HTMLReader" from file '/Users/himself65/Code/LlamaIndexTS/packages/core/src/readers/SimpleDirectoryReader.ts'
src/index.ts(27,15): error TS6307: File '/Users/himself65/Code/LlamaIndexTS/packages/core/src/readers/MarkdownReader.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:
    Imported via "./readers/MarkdownReader" from file '/Users/himself65/Code/LlamaIndexTS/packages/core/src/index.ts'
    Imported via "./MarkdownReader" from file '/Users/himself65/Code/LlamaIndexTS/packages/core/src/readers/SimpleDirectoryReader.ts'
src/index.ts(28,15): error TS6307: File '/Users/himself65/Code/LlamaIndexTS/packages/core/src/readers/NotionReader.ts' is not listed within the file list of project ''. Projects must list all files or use an 'include' pattern.
src/index.ts(29,15): error TS6307: File '/Users/himself65/Code/LlamaIndexTS/packages/core/src/readers/PDFReader.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:
    Imported via "./readers/PDFReader" from file '/Users/himself65/Code/LlamaIndexTS/packages/core/src/index.ts'
    Imported via "./PDFReader" from file '/Users/himself65/Code/LlamaIndexTS/packages/core/src/readers/SimpleDirectoryReader.ts'
src/index.ts(30,15): error TS6307: File '/Users/himself65/Code/LlamaIndexTS/packages/core/src/readers/SimpleDirectoryReader.ts' is not listed within the file list of project ''. Projects must list all files or use an 'include' pattern.
src/index.ts(31,15): error TS6307: File '/Users/himself65/Code/LlamaIndexTS/packages/core/src/readers/SimpleMongoReader.ts' is not listed within the file list of project ''. Projects must list all files or use an 'include' pattern.

⨯ RollupError: Failed to compile. Check the logs above.
    at Object.error (/Users/himself65/Code/LlamaIndexTS/node_modules/.pnpm/rollup@4.9.5/node_modules/rollup/dist/shared/parseAst.js:279:30)
    at Object.error (/Users/himself65/Code/LlamaIndexTS/node_modules/.pnpm/rollup@4.9.5/node_modules/rollup/dist/shared/rollup.js:820:32)
    at Object.error (/Users/himself65/Code/LlamaIndexTS/node_modules/.pnpm/rollup@4.9.5/node_modules/rollup/dist/shared/rollup.js:18666:42)
    at generateDtsFromTs (/Users/himself65/Code/LlamaIndexTS/node_modules/.pnpm/rollup-plugin-dts@6.1.0_rollup@4.9.5_typescript@5.3.3/node_modules/rollup-plugin-dts/dist/rollup-plugin-dts.cjs:1857:30)
    at Object.transform (/Users/himself65/Code/LlamaIndexTS/node_modules/.pnpm/rollup-plugin-dts@6.1.0_rollup@4.9.5_typescript@5.3.3/node_modules/rollup-plugin-dts/dist/rollup-plugin-dts.cjs:1866:38)
    at /Users/himself65/Code/LlamaIndexTS/node_modules/.pnpm/rollup@4.9.5/node_modules/rollup/dist/shared/rollup.js:1005:40
 ELIFECYCLE  Command failed with exit code 1.

Process finished with exit code 1
mverissimo commented 10 months ago

Could you share your tsconfig? I'm facing the same problem, but when trying to use composite: true

himself65 commented 10 months ago

see https://github.com/run-llama/LlamaIndexTS/blob/main/tsconfig.json

huozhi commented 10 months ago

It's caused by the root project ts config mixing with the composite, incremental. When it's setting composite: true in your sub project it gonna have potential break the types generation. Recommendly separate that from the project which has been referenced in the sub project tsconfig.

The patch 4.4.3 is disabling it for now. Will follow up later to see if we can improve that.