google / google/gts

NextJS Module not found: Can't resolve 'components/layout'

Open
#557 0 comments 0 reactions 0 assignees View on GitHub
type: docs
Dominant language
TypeScript
Stars
5.3k
Forks
212
PR merge metrics
No merged PRs in 30d

Description

Hello. I was want to try gts in my project. After 'npx gts init' when I try to start my project I getting an error:

```
error - ./pages/_app.tsx:6:0
Module not found: Can't resolve 'components/layout'
import Layout from "components/layout";
```
Before gts everything was good. Anyone have any ideas?

### 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 (



{children}


);
};

export default Layout;
[...]
```

**Adding baseUrl to tsconfig.json fix that problem:**
```
"compilerOptions": {
"baseUrl": ".",
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.