NativeScript / nativescript-dev-webpack

A package to help with webpacking NativeScript apps.
Apache License 2.0
97 stars 49 forks source link

APK size is huge in {N} 3.4.0 #403

Closed Sharique-Hasan closed 6 years ago

Sharique-Hasan commented 6 years ago

With tns-android@3.2.0 and {N}@3.3.0 my app's relased apk size was 44.5 MB. When I created the new app via SideKick with {N}@3.4.0 and angular@5.x.x I got the release apk size of 78 MB without uglification and snapshot.

I even eliminated few of my plugins too in a hope to have a reduced apk size. But I got even bigger apk size.

My App@3.4.0

{
  "description": "My App",
  "license": "SEE LICENSE IN <your-license-filename>",
  "readme": "NativeScript Application",
  "repository": "<fill-your-repository-here>",
  "nativescript": {
    "id": "com.myapp.myapplication",
    "tns-android": {
      "version": "3.4.0"
    }
  },
  "scripts": {
    "lint": "tslint \"app/**/*.ts\""
  },
  "dependencies": {
    "@angular/animations": "5.1.0",
    "@angular/common": "5.1.0",
    "@angular/compiler": "5.1.0",
    "@angular/core": "5.1.0",
    "@angular/forms": "5.1.0",
    "@angular/http": "5.1.0",
    "@angular/platform-browser": "5.1.0",
    "@angular/platform-browser-dynamic": "5.1.0",
    "@angular/router": "5.1.0",
    "@ngrx/effects": "4.1.1",
    "@ngrx/store": "4.1.1",
    "@ngx-translate/core": "9.0.2",
    "@ngx-translate/http-loader": "2.0.1",
    "@types/lodash": "4.14.92",
    "@types/node": "9.3.0",
    "lodash": "4.17.4",
    "moment": "2.20.1",
    "nativescript-angular": "5.1.0",
    "nativescript-appversion": "1.4.1",
    "nativescript-background-http": "3.1.0",
    "nativescript-camera": "3.2.1",
    "nativescript-facebook": "2.1.0",
    "nativescript-loading-indicator": "2.4.0",
    "nativescript-local-notifications": "2.0.2",
    "nativescript-localstorage": "1.1.5",
    "nativescript-mediafilepicker": "1.0.4",
    "nativescript-plugin-firebase": "^5.1.2",
    "nativescript-plugin-twitter": "2.0.7",
    "nativescript-pro-ui": "~3.3.0",
    "nativescript-sentry": "1.5.2",
    "nativescript-sms-inbox": "1.0.7",
    "nativescript-social-share": "1.5.0",
    "nativescript-theme-core": "~1.0.4",
    "nativescript-toast": "1.4.6",
    "nativescript-videorecorder": "2.0.4",
    "nativescript-web-image-cache": "4.2.2",
    "reflect-metadata": "~0.1.10",
    "rxjs": "5.5.2",
    "tns-core-modules": "~3.4.0",
    "zone.js": "~0.8.18"
  },
  "devDependencies": {
    "@angular/compiler-cli": "~5.1.0",
    "@ngtools/webpack": "~1.9.1",
    "babel-traverse": "6.4.5",
    "babel-types": "6.4.5",
    "babylon": "6.4.5",
    "codelyzer": "~4.0.2",
    "copy-webpack-plugin": "~4.3.0",
    "css-loader": "~0.28.7",
    "extract-text-webpack-plugin": "~3.0.2",
    "lazy": "1.0.11",
    "nativescript-dev-sass": "~1.3.5",
    "nativescript-dev-typescript": "~0.6.0",
    "nativescript-dev-webpack": "~0.9.0",
    "nativescript-worker-loader": "~0.8.1",
    "raw-loader": "~0.5.1",
    "resolve-url-loader": "~2.2.1",
    "sass-loader": "~6.0.6",
    "tslint": "~5.8.0",
    "typescript": "^2.6.2",
    "uglifyjs-webpack-plugin": "~1.1.6",
    "webpack": "~3.10.0",
    "webpack-bundle-analyzer": "^2.9.1",
    "webpack-sources": "~1.1.0"
  }
}

My App@3.2.0

{
  "description": "My App",
  "license": "SEE LICENSE IN <your-license-filename>",
  "readme": "NativeScript Application",
  "repository": "<fill-your-repository-here>",
  "nativescript": {
    "id": "com.myapp.myapplication",
    "tns-android": {
      "version": "3.2.0"
    }
  },
  "scripts": {
    "update-ng-deps": "./node_modules/nativescript-angular/bin/update-app-ng-deps",
    "lint": "tslint \"app/**/*.ts\"",
    "ns-bundle": "ns-bundle",
    "publish-ios-bundle": "npm run ns-bundle --ios --publish-app",
    "generate-android-snapshot": "generate-android-snapshot --targetArchs arm,arm64,ia32 --install",
    "start-android-bundle": "npm run ns-bundle --android --run-app",
    "start-ios-bundle": "npm run ns-bundle --ios --run-app",
    "build-android-bundle": "npm run ns-bundle --android --build-app",
    "build-ios-bundle": "npm run ns-bundle --ios --build-app"
  },
  "dependencies": {
    "@angular/animations": "4.4.6",
    "@angular/common": "4.4.6",
    "@angular/compiler": "4.4.6",
    "@angular/core": "4.4.6",
    "@angular/forms": "4.4.6",
    "@angular/http": "4.4.6",
    "@angular/platform-browser": "4.4.6",
    "@angular/router": "4.4.6",
    "@ngrx/effects": "4.0.3",
    "@ngrx/store": "4.0.3",
    "@ngx-translate/core": "6.0.1",
    "@ngx-translate/http-loader": "0.0.3",
    "@types/lodash": "4.14.89",
    "lodash": "4.17.4",
    "moment": "2.19.4",
    "nativescript-angular": "4.4.1",
    "nativescript-appversion": "1.4.1",
    "nativescript-background-http": "3.1.0",
    "nativescript-camera": "3.1.2",
    "nativescript-facebook": "2.0.1",
    "nativescript-loading-indicator": "2.4.0",
    "nativescript-local-notifications": "2.0.1",
    "nativescript-localstorage": "1.1.5",
    "nativescript-mediafilepicker": "1.0.4",
    "nativescript-phone": "1.3.1",
    "nativescript-plugin-firebase": "4.2.1",
    "nativescript-pro-ui": "3.2.0",
    "nativescript-sentry": "^1.5.2",
    "nativescript-sms-inbox": "1.0.7",
    "nativescript-social-share": "1.5.0",
    "nativescript-theme-core": "1.0.4",
    "nativescript-toast": "1.4.6",
    "nativescript-twitter": "2.0.3",
    "nativescript-videorecorder": "2.0.4",
    "nativescript-web-image-cache": "4.2.2",
    "reflect-metadata": "0.1.10",
    "rxjs": "5.5.2",
    "tns-core-modules": "3.2.0",
    "world-countries": "1.8.1",
    "zone.js": "0.8.18"
  },
  "devDependencies": {
    "@angular/compiler-cli": "4.4.6",
    "@ngtools/webpack": "1.5.0",
    "babel-traverse": "6.26.0",
    "babel-types": "6.26.0",
    "babylon": "6.18.0",
    "codelyzer": "3.2.0",
    "copy-webpack-plugin": "4.0.1",
    "enhanced-resolve": "3.3.0",
    "extract-text-webpack-plugin": "3.0.0",
    "lazy": "1.0.11",
    "nativescript-angular-cli": "0.1.8",
    "nativescript-css-loader": "~0.26.0",
    "nativescript-dev-sass": "1.3.2",
    "nativescript-dev-typescript": "0.5.1",
    "nativescript-dev-webpack": "0.8.0",
    "nativescript-worker-loader": "0.8.1",
    "node-sass": "4.5.3",
    "raw-loader": "0.5.1",
    "resolve-url-loader": "2.1.0",
    "tslint": "5.7.0",
    "typescript": "2.6.2",
    "uglifyjs-webpack-plugin": "1.0.0-beta.2",
    "webpack": "3.2.0",
    "webpack-bundle-analyzer": "2.8.2",
    "webpack-sources": "1.0.1"
  }
}
sis0k0 commented 6 years ago

Hey there! Probably it's because of https://github.com/NativeScript/nativescript-cli/issues/3280. Can you try updating the nativescript CLI to 3.4.1 and building again?

Sharique-Hasan commented 6 years ago

Sure, I ll check in the morning and will let you know

Sharique-Hasan commented 6 years ago

Updating to 3.4.1 fixed it