-
Notifications
You must be signed in to change notification settings - Fork 61
add support for tsconfig with "extends" #153
Conversation
Great timing on this one. We're getting ready to archive this repo for the move of the plugin to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, but a few comments on conveying errors to users that need to be addressed.
null : | ||
typescript.parseJsonConfigFileContent(tsConfig, typescript.sys, process.cwd(), parsed.options); | ||
if (extendedConfig && extendedConfig.errors.length) { | ||
extendedConfig.errors.forEach( error => console.error( `rollup-plugin-typescript: ${ error.messageText }` ) ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we generally want to shy away from our own console output here. instead, use this.warn
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This plugin is currently using console.error
rather than this.warn
, but we're switching it for the migration. You can choose to switch it now or I can switch it later when migrating 🙂
if (extendedConfig && extendedConfig.errors.length) { | ||
extendedConfig.errors.forEach( error => console.error( `rollup-plugin-typescript: ${ error.messageText }` ) ); | ||
|
||
throw new Error( `rollup-plugin-typescript: Couldn't process compiler options` ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and use this.error
here, as it will let Rollup handle the output and abort the bundling process properly.
Thanks for the feedback! I'm on it! 😄 |
Question. As far as I understand the docs and the plugin structure, in the body of the plugin, i.e. anything before the hooks, I don't have access to Can you help me understand how to get that going? |
Changes
When the original
tsconfig
file contains a "extends" property, usetypescript.parseJsonConfigFileContent
to parse the entire inheritance chain, providing the already parsed config asexistingOptions
.Tests
Added test where the base config is the one that has the
"jsx": "react"
required to make the test pass (copied thetsconfig-jsx
test case)