Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
lostation opened this issue Jul 10, 2022 · 2 comments
Closed

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

lostation opened this issue Jul 10, 2022 · 2 comments

Comments

@lostation
Copy link

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 don't know how to deal the right way with webpackConfigPath: './webpack-custom.config.js' from the NativeScriptConfigto be able to do some files maintenances before the final return webpack.resolveConfig(). I saw that there is a custom Webpack for nativescript with chain able things...but truly ununderstandable for me...how to use that...It seems after the webpack.resolveConfig() I cannot do anything and add other things into the resolved config... ??? I want to be able to pass some variable to the process.env...how to do that ? Can you show me example of webpack customizations ?

  • I don't know how to deal with local npm custom package folder that contains some java files declared from workspace package.json. -> ex: from dependencies "nativescript-markdown-view": "file:ns-libs/nativescript-markdown-view",

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
Copy link
Author

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
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant