diff --git a/src/index.ts b/src/index.ts index ece2663..f21646d 100644 --- a/src/index.ts +++ b/src/index.ts @@ -34,7 +34,11 @@ export default (opts: PluginOptions = {}): Plugin => { let projectRoot = config.root let workspaceRoot!: string - let { root } = opts + let { root, silent } = opts + const tsconfckOptions = { + resolveWithEmptyIfConfigNotFound: silent + } + if (root) { root = resolve(projectRoot, root) } else { @@ -80,14 +84,17 @@ export default (opts: PluginOptions = {}): Plugin => { await Promise.all( projects.map((tsconfigFile) => hasTypeScriptDep - ? tsconfck.parseNative(tsconfigFile) - : tsconfck.parse(tsconfigFile) + ? tsconfck.parseNative(tsconfigFile, tsconfckOptions) + : tsconfck.parse(tsconfigFile, tsconfckOptions) ) ) ) resolversByDir = {} parsedProjects.forEach((project) => { + if(project.tsconfigFile === "no_tsconfig_file_found"){ + return + } // Don't create a resolver for projects with a references array. // Instead, create a resolver for each project in that array. if (project.referenced) { diff --git a/src/types.ts b/src/types.ts index bdf4b9e..9bb7432 100644 --- a/src/types.ts +++ b/src/types.ts @@ -38,6 +38,12 @@ export interface PluginOptions { * necessary. */ parseNative?: boolean + /** + * Enable use of `tsconfck.resolveWithEmptyIfConfigNotFound`. + * If set to false (the default), the plugin will throw an error if no tsconfig file is found. + * @default false + */ + silent?: boolean } export interface TSConfig {