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

Update tsconfig.json #560

Closed
wants to merge 1 commit into from
Closed

Update tsconfig.json #560

wants to merge 1 commit into from

Conversation

oskar-gmerek
Copy link

@oskar-gmerek oskar-gmerek commented Sep 4, 2020

Fixes resolving non-relative module names. ( #557 )

Fixes resolving non-relative module names.
@google-cla
Copy link

google-cla bot commented Sep 4, 2020

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

@google-cla google-cla bot added the cla: no label Sep 4, 2020
@JustinBeckwith
Copy link
Collaborator

Greetings! Can you share a few more details? What specifically is failing that you're trying to fix?

@oskar-gmerek
Copy link
Author

oskar-gmerek commented Sep 5, 2020

@JustinBeckwith
Hello. Like in #557 without defined baseUrl, gts crashes the app, unable to import the files properly, resulting in a fatal error.

Edit

App structure in my case:

App
- components
-- layout
--- container.tsx
--- index.tsx 
- lib
-- [...]
- node_modules
-- [...]
- pages
-- _app.tsx
-- error.tsx
-- index.tsx
- public
-- [...]

Error:

error - ./pages/_app.tsx:6:0
Module not found: Can't resolve 'components/layout'
import Layout from "components/layout";

Line 6 of _app.tsx:

import Layout from "components/layout";

File components/layout/index.tsx contains:

[...]
const Layout: FC = ({ children }) => {
  return (
    <ColorModeProvider>
      <LightMode>
        <Navbar />
        <Container>{children}</Container>
      </LightMode>
    </ColorModeProvider>
  );
};

export default Layout;
[...]

Adding baseUrl to tsconfig.json fix that problem:

"compilerOptions": {
    "baseUrl": ".",
}

Base automatically changed from master to main January 22, 2021 22:38
@oskar-gmerek oskar-gmerek deleted the patch-2 branch March 25, 2022 14:43
@Justice-Orogun
Copy link

I have exactly the same error right now..... Keeps telling me "Module not found"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants