lerna/getting-started-example

could not resolve "header'

Closed this issue · 6 comments

I follow the getting-started strictly
but i didn't get expect result。

when i run
lerna run build

occur some exceptions

✘ [ERROR] Could not resolve "header"

           app/routes/index.tsx:1:21:
             1 │ import {Header} from 'header';
               ╵                      ~~~~~~~~

         You can mark the path "header" as external to exclude it from the bundle, which will remove this error.

        ✘ [ERROR] Could not resolve "footer"

           app/routes/index.tsx:2:21:
             2 │ import {Footer} from 'footer';

Recurrence steps

git clone https://github.com/lerna/getting-started-example.git
cd getting-started-example
git checkout prelerna
npm install
npx lerna init
npx nx graph // open browser but show nothing
npx lerna bootstrap
npx lerna run build // occur exception

copy all of them into bash, can recurrence

I have same experience. It didn't work at all.

Even including npx lerna graph as well.

I fixed the version of lerna to lerna: 5.1.6 and change all the react dependencies to v18.x.x, and then it worked.

you can still use react v17.x.x if you set "declaration": true in compilerOptions field from tsconfig.json file of header folder and footer folder. After that, you run npx lerna run build, then you can resolve "header'. At the meantime, lerna: 5.1.6, react v17.x.x

@KunHwanAhn

npx lerna init

you do not need do this npx lerna init

@clearRiddle

actually only remix project react version is v17.x.x, I just modify it to v18.1.1 which is some to header and footer react version.
I can see the correct result in the page, but in remix project, header and footer are still not resolve.
@KunHwanAhn

I ran through this again and couldn't reproduce it with lerna 5.6.2. It could have been resolved in recent version. Reopen if it is still a problem.