NativeScript / nx

NativeScript for Nx.
Other
61 stars 15 forks source link

NS 6 TNS -> NX Workspace with ANGULAR 13 WEB and Mobile NS 8 #56

Closed lostation closed 2 years ago

lostation commented 2 years ago

Hi guys,

Please, I need help...

I'm really scratching my head from weeks now to migrate my old "shared angular tns project" and create nx workspace for web and nativescript with angular...

Every core things have been transferred to the libs/xplat ... and I've put all my pages, routes etc into apps/nativescript-app.

Nx concept should make my working days happier but for now, really it is not the case...I hope one day it will ;) ...

Anyway, I tried so many different configurations of package version to stick with angular 13 and to get everything that fits.

But know I need some help to debug WTH is happening with WEBPACK.

Webpack has always be the obscurest part of compiling stuffs. Now I'm sure.

Then...everything should be ready for mobile app part -> nx run nativescript-app:android:dev

and Crash Boom...

Here the thing that's making me crazy.

Start webpack.config.js

assets by status 0 bytes [cached] 1 asset

WARNING in configuration
The 'mode' option has not been set, webpack will fallback to 'production' for this value.
Set 'mode' option to 'development' or 'production' to enable defaults for each environment.
You can also set it to 'none' to disable any default behavior. Learn more: https://webpack.js.org/configuration/mode/

ERROR in main
Module not found: Error: Can't resolve './src' in '/Volumes/Data/project/apps/nativescript-app'
resolve './src' in '/Volumes/Data/project/apps/nativescript-app'
  using description file: /Volumes/Data/project/apps/nativescript-app/package.json (relative path: .)
    using description file: /Volumes/Data/project/apps/nativescript-app/package.json (relative path: ./src)
      no extension
        /Volumes/Data/project/apps/nativescript-app/src is not a file
      .js
        /Volumes/Data/project/apps/nativescript-app/src.js doesn't exist
      .json
        /Volumes/Data/project/apps/nativescript-app/src.json doesn't exist
      .wasm
        /Volumes/Data/project/apps/nativescript-app/src.wasm doesn't exist
      as directory
        existing directory /Volumes/Data/project/apps/nativescript-app/src
          using description file: /Volumes/Data/projectapps/nativescript-app/package.json (relative path: ./src)
            using path: /Volumes/Data/project/apps/nativescript-app/src/index
              using description file: Volumes/Data/project/apps/nativescript-app/package.json (relative path: ./src/index)
                no extension
                  /Volumes/Data/project/apps/nativescript-app/src/index doesn't exist
                .js
                  /Volumes/Data/project/apps/nativescript-app/src/index.js doesn't exist
                .json
                  Volumes/Data/project/apps/nativescript-app/src/index.json doesn't exist
                .wasm
                  /Volumes/Data/project/apps/nativescript-app/src/index.wasm doesn't exist

webpack 5.73.0 compiled with 1 error and 1 warning in 1349 ms

I've redo another empty project to compare...and this one is working fine with Webpack... I've checked and compared every same files, project.json, tsconfig, workspace.json etc...

But for the big fulfilled mobile project (with app and core files)...it's not webpacking...and stucked with the error above But for the another demo project it's working...

Do you know or already had this kind of message ? Can you tell my some way to debug weback and understand what's wrong... I'm spending all my days to understand why ... searching on the internet... It's exhausting...really.

I've also others questions...

I've created an ns-libs at workspace level...I don't know why the java file are not compiled...I've this -> Error executing Static Binding Generator: Class not found com.custom.markwon.StringCallback... Should I put all this custom local lib into the app folder ? But then I cannot access them from the xplat... ??? Should I create some .aar to contain the java classes ? How to do that ?

I've added ns-libs folders into tsconfig.app.json

 "include": [
    "../../libs/xplat/core/src/lib/environments/environment.ts",
    "../../ns-libs",    ??? I don't know if I should do that ?
  ],
  "files": [
    "./references.d.ts",
    "./src/main.ts",
    "./src/polyfills.ts",
    "../../typings.d.ts", ??? And also add some workspace level typings ?
  ]

Thanks in advance for any help ; )

lostation commented 2 years ago

So it seems, while running nx run nativescript-app:android:dev, webpack fallbacks to a default config or entry... It seems webpack is looking for a Workspace root level folder src that doesn't exist -> src/index.js But the webpack.config.js is running... so is there entry point or context to customize, override, verify ?

lostation commented 2 years ago

https://github.com/nstudio/xplat/issues/275#issuecomment-1180580262