Skip to content

jsconfig ignored? #304

Open
Open
@texastoland

Description

@texastoland

What happens and why it is wrong

I was struggling with generating JSDoc typings for a library using Microdundle. It generated index.d.ts but none of the imported files. The root issue was missing "include" : ["src"] (inspired by #211). I tried adding it to jsconfig.json after scouring issues here as well as in Microbundle and TSDX. I finally tried renaming to tsconfig.json and resolved my issue.

Suggested fix

Arguably this might belong in Microbundle if JSDoc typings aren't an intended use case for this plugin? Or just manually pass "jsconfig.json".

const fileName = tsModule.findConfigFile(pluginOptions.cwd, tsModule.sys.fileExists, pluginOptions.tsconfig);
// if the value was provided, but no file, fail hard
if (pluginOptions.tsconfig !== undefined && !fileName)
throw new Error(`failed to open '${fileName}'`);

	const getConfig = (name) => tsModule.findConfigFile(pluginOptions.cwd, tsModule.sys.fileExists, name);
	const fileName =
		getConfig(pluginOptions.tsconfig) ||
		// if the value was provided, but no file, fail hard (previously `failed to open undefined`)
		(pluginOptions.tsconfig && throw new Error(`failed to open '${pluginOptions.tsconfig}'`)) ||
		getConfig("jsconfig.json");

Environment

Versions

From package-lock.json (envinfo doesn't list nested dependencies):

  npmPackages:
    typescript: 4.5.5
    rollup: 2.67.2
    rollup-plugin-typescript2: 0.29.0

rollup.config.js

`rollup.config.js`:

https://github.com/developit/microbundle/blob/v0.14.2/src/index.js#L523-L556

tsconfig.json

`tsconfig.json`:

include (described above) is the only key in tsconfig.json.

package.json

`package.json`:
  npmPackages:
    microbundle: ^0.14.2 => 0.14.2

plugin output with verbosity 3

plugin output with verbosity 3:

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions