Skip to content
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

Cannot read property 'baseUrl' of undefined #93

Open
namnm opened this issue Feb 5, 2023 · 0 comments
Open

Cannot read property 'baseUrl' of undefined #93

namnm opened this issue Feb 5, 2023 · 0 comments

Comments

@namnm
Copy link

namnm commented Feb 5, 2023

node_modules/react-app-alias/src/index.js:199
    baseUrl: conf.compilerOptions.baseUrl || '.',
                                  ^

The config fully extends from another, there is no compilerOptions when using console.log to see:

{
  extends: {
    compilerOptions: {
      module: 'esnext',
      target: 'es5',
      lib: [Array],
      allowJs: false,
      checkJs: false,
      resolveJsonModule: true,
      jsx: 'react-jsx',
      declaration: false,
      declarationMap: false,
      sourceMap: false,
      noEmit: true,
      isolatedModules: true,
      skipLibCheck: true,
      strict: true,
      noImplicitAny: false,
      strictNullChecks: true,
      strictFunctionTypes: true,
      strictPropertyInitialization: false,
      noImplicitThis: true,
      alwaysStrict: true,
      forceConsistentCasingInFileNames: true,
      noImplicitReturns: true,
      noFallthroughCasesInSwitch: true,
      moduleResolution: 'node',
      paths: [Object],
      allowSyntheticDefaultImports: true,
      esModuleInterop: true,
      experimentalDecorators: false,
      emitDecoratorMetadata: false
    },
    include: [ './**/*' ]
  }
}

This can be fixed by using a condition?

let compilerOptions = conf.compilerOptions
if (!compilerOptions && conf.extends) {
  compilerOptions = conf.extends.compilerOptions
}
let baseUrl
if (compilerOptions) {
  baseUrl = compilerOptions.baseUrl
}
if (!baseUrl) {
  baseUrl = '.'
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant