Failing to deploy: Cannot find module... or its corresponding type declarations.
Hi everyone, I'm trying to deploy my app and doing a local build works as expected. However, when deploying to Netlify, I'm running into an issue where certain component aren't being found. I've triple checked spelling but no luck.
tsconfig.json:
Imports in App.tsx:
Export in src/components/layout/Header.tsx:
src/App.tsx(7,24): error TS2307: Cannot find module './components/layout/Header' or its corresponding type declarations.
src/App.tsx(8,23): error TS2307: Cannot find module './components/layout/Title' or its corresponding type declarations.
src/components/layout/Layout.tsx(3,41): error TS2307: Cannot find module './Header' or its corresponding type declarations.
src/components/layout/header.tsx(6,23): error TS2307: Cannot find module './Title' or its corresponding type declarations.
src/components/layout/header.tsx(7,22): error TS2307: Cannot find module '../header/DropMenu' or its corresponding type declarations.
Error: Command "tsc && refine build" exited with 2src/App.tsx(7,24): error TS2307: Cannot find module './components/layout/Header' or its corresponding type declarations.
src/App.tsx(8,23): error TS2307: Cannot find module './components/layout/Title' or its corresponding type declarations.
src/components/layout/Layout.tsx(3,41): error TS2307: Cannot find module './Header' or its corresponding type declarations.
src/components/layout/header.tsx(6,23): error TS2307: Cannot find module './Title' or its corresponding type declarations.
src/components/layout/header.tsx(7,22): error TS2307: Cannot find module '../header/DropMenu' or its corresponding type declarations.
Error: Command "tsc && refine build" exited with 2tsconfig.json:
{
"compilerOptions": {
"baseUrl": "./src",
"paths": {
"@/*": ["./src/*"]
},
"target": "ESNext",
"useDefineForClassFields": true,
"lib": ["DOM", "DOM.Iterable", "ESNext"],
"allowJs": false,
"skipLibCheck": true,
"esModuleInterop": false,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"module": "ESNext",
"moduleResolution": "Node",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react-jsx"
},
"include": ["src", "vite.config.ts"],
"references": [
{
"path": "./tsconfig.node.json"
}
]
}{
"compilerOptions": {
"baseUrl": "./src",
"paths": {
"@/*": ["./src/*"]
},
"target": "ESNext",
"useDefineForClassFields": true,
"lib": ["DOM", "DOM.Iterable", "ESNext"],
"allowJs": false,
"skipLibCheck": true,
"esModuleInterop": false,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"module": "ESNext",
"moduleResolution": "Node",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react-jsx"
},
"include": ["src", "vite.config.ts"],
"references": [
{
"path": "./tsconfig.node.json"
}
]
}Imports in App.tsx:
import { Layout } from './components/layout/Layout';
import { Header } from './components/layout/Header';
import { Title } from './components/layout/Title';import { Layout } from './components/layout/Layout';
import { Header } from './components/layout/Header';
import { Title } from './components/layout/Title';Export in src/components/layout/Header.tsx:
export const Header: React.FC<RefineThemedLayoutV2HeaderProps> = () => {
return (
<>
{ /* CODE HERE */}
</>
);
};export const Header: React.FC<RefineThemedLayoutV2HeaderProps> = () => {
return (
<>
{ /* CODE HERE */}
</>
);
};