You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to migrate to nx tool and during my migration, i faced several issues. In my monorepo I have two simple projects webApp(nextjs) and test-ui(react).
nx g @nx/next:app webApp --directory packages
nx g @nx/react:library test-ui --directory packages
Then i created a new file in packages\test-ui\src\utils\text.ts export const myText = "Mytext";
In packages\test-ui\src\lib\test-ui.tsx
import {myText} from "utils/text"
export function TestUi() {
return (
<div>
<h1>{myText}</h1>
</div>
);
}
export default TestUi;
Also i edited tsconfig.ts in test-ui project. Just added a "paths": {"utils": ["utils"], }
In packages\webApp\src\pages\index.tsx i use component.
import { TestUi } from '@frontend-mono/test-ui';
export default function Home() {
return (
<TestUi></TestUi>
)
}
Any attempt to run webApp(nx run webApp:dev) leads to this error:
../test-ui/src/lib/test-ui.tsx:1:22
Type error: Cannot find module 'utils/text' or its corresponding type declarations.
> 1 | import {myText} from "utils/text"
I'm new to this tool and would really appreciate any help.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I want to migrate to nx tool and during my migration, i faced several issues. In my monorepo I have two simple projects webApp(nextjs) and test-ui(react).
nx g @nx/next:app webApp --directory packages
nx g @nx/react:library test-ui --directory packages
Then i created a new file in packages\test-ui\src\utils\text.ts
export const myText = "Mytext";
In packages\test-ui\src\lib\test-ui.tsx
Also i edited tsconfig.ts in test-ui project. Just added a "paths": {"utils": ["utils"], }
In packages\webApp\src\pages\index.tsx i use component.
Any attempt to run webApp(nx run webApp:dev) leads to this error:
I'm new to this tool and would really appreciate any help.
Beta Was this translation helpful? Give feedback.
All reactions