Skip to content

Commit

Permalink
Remap tsconfig for builds so that only files under src are considered
Browse files Browse the repository at this point in the history
  • Loading branch information
Luke Sheard committed Dec 31, 2020
1 parent efd9939 commit 6be4085
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 4 deletions.
6 changes: 6 additions & 0 deletions .changeset/wet-nails-care.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'modular-scripts': patch
---

Fix an issue where generated files from libraries would interfere with
typescript definition generation
2 changes: 1 addition & 1 deletion packages/create-modular-react-app/template/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@
"noEmit": true,
"jsx": "react-jsx"
},
"include": ["packages"]
"include": ["packages/*/src"]
}
5 changes: 4 additions & 1 deletion packages/modular-scripts/src/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,10 @@ function makeTypings(directoryName: string) {
};

// then add our custom stuff
tsconfig.include = [`${packagesRoot}/${directoryName}`];

// Only include src files from the package to prevent already built
// files from interferring with the compile
tsconfig.include = [`${packagesRoot}/${directoryName}/src`];
tsconfig.compilerOptions = {
...tsconfig.compilerOptions,
declarationDir: `${packagesRoot}/${directoryName}/${outputDirectory}/types`,
Expand Down
2 changes: 1 addition & 1 deletion packages/tree-view-for-tests/src/__tests__/tree.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ test('it can serialise a folder', () => {
│ └─ setupTests.ts #bnjknz
├─ packages
│ └─ README.md #14bthrh
└─ tsconfig.json #e5344q"
└─ tsconfig.json #sm7bga"
`);
});
3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,6 @@
"forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */,
"sourceMap": true,
"incremental": true
}
},
"include": ["packages/*/src"]
}

0 comments on commit 6be4085

Please sign in to comment.