-
Notifications
You must be signed in to change notification settings - Fork 3
feat: add extends field support #6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
@dudiq is this PR still alive? |
@zachbryant i guess this question is more to you. i can't merge it to master and resolve problem with extend field |
@dudiq are you able to see the comments I left in review? |
@zachbryant nope |
@zachbryant still no any comments |
); | ||
if (!result?.config) { | ||
throw new Error(`Missing or invalid tsconfig.json in project root (${options.projectRoot})`); | ||
throw new Error(`Missing or invalid ${names.join(',')} in project root (${options.projectRoot})`); |
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.
nit: add space after comma
} | ||
|
||
async function loadCompilerOptions(options, resolveFrom) { | ||
let baseConfig = await loadConfigByName(['tsconfig.json', 'tsconfig.js'], options, resolveFrom) |
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.
The naming of this variable is ambiguous. I suggest childConfig
for this line and parentConfig
in place of extendsConfig
return result.config; | ||
} | ||
|
||
async function loadCompilerOptions(options, resolveFrom) { |
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.
To reduce references to compilerOptions let's keep loadConfig
and have loadCompilerOptions
call the former and do error checks
return baseConfig.compilerOptions | ||
} | ||
let extendsConfig = await loadConfigByName([baseConfig.extends], options, resolveFrom) | ||
return extendsConfig?.compilerOptions || baseConfig?.compilerOptions ? { |
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.
If the project tsconfig extends another, this line drops the base config entirely. Unless items are undefined (I expect missing keys to just be missing rather than undefined, but I'll double check), it should just be:
return {
...extendsConfig.compilerOptions,
...baseConfig.compilerOptions,
};
return baseConfig.compilerOptions | ||
} | ||
let extendsConfig = await loadConfigByName([baseConfig.extends], options, resolveFrom) | ||
return extendsConfig?.compilerOptions || baseConfig?.compilerOptions ? { |
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.
loadConfigByName
checks for null results already, so qualifiers are not needed
/** Populate a map with any paths from tsconfig.json starting from baseUrl */ | ||
async function loadTsPaths(resolveFrom: string, options, logger): Promise<PathMapType> { | ||
let config = await loadConfig(options, resolveFrom); | ||
let compilerOptions = config?.['compilerOptions']; |
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.
I would like to keep this line just to reduce code size
Woops, I don't use github for reviews enough 😂 should be visible now |
Hi @dudiq & @zachbryant, any updates on this? I'm happy to open a new PR if this is no longer being worked on. |
Hey @jlalmes , I'd be happy to see a PR here. I can get to this shortly if you'd prefer I do it. Timelines on updates for this have slowed as I don't use parcel much these days |
In some cases
tsconfig.json
mayextends
from other file. And it may havebaseUrl
withpaths
fields inside