Sliqric7053 / cross-platform-monorepo

Build a Webapp, Desktop and iOS / Android Apps from a monorepo using Angular
12 stars 8 forks source link

Can't resolve '@game-engine-lib' #1

Open akarora11 opened 3 years ago

akarora11 commented 3 years ago

Hello, When I am trying to run the application, It shows " ERROR in ./src/app/app.module.ts Module not found: Error: Can't resolve '@game-engine-lib' in '/data/cross-platform-monorepo/projects/tetris/src/app' " whereas this error occurs only while running the application and it doesn't show error while import. Can you please help me in this.

Thanks

Sliqric7053 commented 3 years ago

Hi Akarora11

Whenever you make changes to a library, you must rebuild that library.

Run ng build game-engine-lib --watch to build and watch for changes on file save (as explained in the article).

See the scripts section of the package.json file for all the scripts you can run.

Best,

akarora11 commented 3 years ago

Hello sir, Thanks for response. But I tried to rebuild the library but still it shows me this error. Although after running the command this is the output I get : `cross-platform-monorepo$ npm run build:game-engine-lib --watch

cross-platform-monorepo@0.0.0 build:game-engine-lib /data/cross-platform-monorepo ng build game-engine-lib --watch

Building Angular Package


It is not recommended to publish Ivy libraries to NPM repositories. Read more here: https://v9.angular.io/guide/ivy#maintaining-library-compatibility



Building entry point 'game-engine-lib'

Compiling TypeScript sources through ngc Bundling to FESM2015 Bundling to UMD Minifying UMD bundle Writing package metadata Built game-engine-lib


Built Angular Package

Compilation complete. Watching for file changes... ` After that I try to run the tetris application and it won't work

Sliqric7053 commented 3 years ago

Could you please provide answers to the below questions:

  1. What are the exact steps to reproduce this error?

  2. Did you fork the cross-platform-monorepo repo or did you start a fresh Angular project and followed the steps in the article?

    After that I try to run the tetris application and it won't work

  3. What command did you use to run the tetris application and what is the exact error message?

akarora11 commented 3 years ago

Ahh I got the error, I import the wrong GameEngineLib in tetris module.

but when I add the right one and run this command "npm run start:tetris"

ERROR in Cannot read property '0' of undefined.

And in browser it shows "Cannot GET /"

Is this is expected behavior?

Also I fork the cross-platform-monorepo and followed the steps mentioned in the article

Thanks Anuj

Sliqric7053 commented 3 years ago

Hi Anuj

If you forked the project, then you only need to run the following commands (from the root of the project):

  1. npm install
  2. npm run build
  3. npm run start

This will launch both the Electron and Web applications.

Please try it and let me know how it goes.

Cheers