Skip to content

Error when combining --bundle and --env.uglify #4262

Closed

Description

@mhzokaii

Environment

  • CLI: 5.1.0
  • Android Runtime: 5.1.0

package.json content:

{
  "description": "NativeScript Application",
  "license": "SEE LICENSE IN <your-license-filename>",
  "readme": "NativeScript Application",
  "repository": "<fill-your-repository-here>",
  "nativescript": {
    "id": "org.nativescript.blankng",
    "tns-ios": {
      "version": "5.1.0"
    },
    "tns-android": {
      "version": "5.1.0"
    }
  },
  "dependencies": {
    "@angular/animations": "7.1.2",
    "@angular/common": "7.1.2",
    "@angular/compiler": "7.1.2",
    "@angular/core": "7.1.2",
    "@angular/forms": "7.1.2",
    "@angular/http": "7.1.2",
    "@angular/platform-browser": "7.1.2",
    "@angular/platform-browser-dynamic": "7.1.2",
    "@angular/router": "7.1.2",
    "@progress-nativechat/nativescript-nativechat": "2.0.3",
    "kinvey-nativescript-sdk": "3.12.3",
    "nativescript-accelerometer": "2.0.1",
    "nativescript-angular": "7.1.0",
    "nativescript-background-http": "3.3.1",
    "nativescript-camera": "4.1.1",
    "nativescript-fresco": "5.1.0",
    "nativescript-geolocation": "4.3.1",
    "nativescript-imagepicker": "6.0.5",
    "nativescript-intl": "3.0.0",
    "nativescript-iqkeyboardmanager": "1.3.0",
    "nativescript-social-share": "1.5.1",
    "nativescript-theme-core": "1.0.4",
    "nativescript-ui-autocomplete": "3.10.3",
    "nativescript-ui-calendar": "3.10.0",
    "nativescript-ui-chart": "3.11.1",
    "nativescript-ui-dataform": "3.9.1",
    "nativescript-ui-gauge": "3.7.1",
    "nativescript-ui-listview": "5.0.1",
    "nativescript-ui-sidedrawer": "5.0.1",
    "reflect-metadata": "0.1.12",
    "rxjs": "6.3.3",
    "tns-core-modules": "5.1.0",
    "zone.js": "0.8.26"
  },
  "devDependencies": {
    "@angular/compiler-cli": "~7.0.0",
    "@ngtools/webpack": "~7.0.0",
    "nativescript-dev-typescript": "0.7.8",
    "nativescript-dev-webpack": "0.18.2",
    "tns-platform-declarations": "5.1.0",
    "typescript": "3.1.6"
  }
}

Describe the bug
Both tns run android --bundle and tns run android --env.uglify works correctly, but when combined together, tns run android --bundle --env.uglify, I receive this error and the app crashes just after the refresh:

...
Project successfully built.
Installing on device HQ565YL25643...
Successfully installed on device with identifier 'HQ565YL25643'.
Refreshing application on device HQ565YL25643...
Successfully synced application org.nativescript.HelloWorld on device HQ565YL25643.
ActivityManager: Start proc org.nativescript.HelloWorld for activity org.nativescript.HelloWorld/com.tns.NativeScriptActivity: pid=25413 uid=10274 gids={50274, 1028, 1015, 3003}
ActivityManager: getContentProviderImpl: from callerandroid.app.ApplicationThreadProxy@436256f8 (pid=25413) to get content provider settings
D/ActivityThread(25413): hoder:android.app.IActivityManager$ContentProviderHolder@4213dd78,provider,holder.Provider:android.content.ContentProviderProxy@4213e4f8
System.err: java.lang.RuntimeException: Unable to start activity ComponentInfo{org.nativescript.HelloWorld/com.tns.NativeScriptActivity}: com.tns.NativeScriptException: 
System.err: Calling js method onCreate failed
System.err: Error: moduleId should be a string in "t". See https://goo.gl/wIDDiL for more information.
System.err: If you're using Webpack you should inline the template and the styles, see https://goo.gl/X2J8zc.
System.err: File: "file:///data/data/org.nativescript.HelloWorld/files/app/vendor.js, line: 1, column: 1721655
System.err: StackTrace: 
System.err: 	Frame: function:'c', file:'file:///data/data/org.nativescript.HelloWorld/files/app/vendor.js', line: 1, column: 1548596
...

I have tried multiple projects, new, cloned from the git, or downloaded from playground.

Tried

  • moduleId: module.id -> moduleId: module.id.toString()
  • moduleId: module.id -> moduleId: 'module.id' (somewhere was suggested it will resolve the issue)
  • remove moduleId: module.id

nothing helps.

Thank you.

Activity

  1. dtopuzov commented on Jan 9, 2019

    @dtopuzov
    Contributor
  2. dtopuzov commented on Jan 9, 2019

    @dtopuzov
    Contributor

    Fixed by NativeScript/nativescript-angular#1686
    Fix will be available in next official release of nativescript-angular, but if you need it earlier you can try nativescript-angular@next

    Btw, I think workaround is available.
    Just add aot option as well:
    tns run android --bundle --env.uglify --env.aot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions