feat(core): add user-friendly error on invalid input
Prevent cryptic error of `TypeError: Cannot read property 'map' of undefined`, which doesn't guide the user towards success
This commit is contained in:
parent
d1f740e264
commit
adc34f82e3
@ -88,7 +88,14 @@ export function updateImports(schema: Schema) {
|
||||
const path = tsConfig.compilerOptions.paths[
|
||||
projectRef.from
|
||||
] as string[];
|
||||
|
||||
if (!path) {
|
||||
throw new Error(
|
||||
[
|
||||
`unable to find "${projectRef.from}" in`,
|
||||
`${tsConfigPath} compilerOptions.paths`,
|
||||
].join(' ')
|
||||
);
|
||||
}
|
||||
const updatedPath = path.map((x) =>
|
||||
x.replace(new RegExp(projectRoot.from, 'g'), projectRoot.to)
|
||||
);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user