Ionic-cli: Ionic CLI does not remove 2.3MB worth of unused Font files from cordova builds (context.target set to null)

Created on 16 Aug 2017  路  4Comments  路  Source: ionic-team/ionic-cli

Ionic CLI has code to remove unused Font files from cordova builds, but that code fails to execute because context.target is set to null (instead of 'cordova').

<project-path>/node_modules/@ionic/app-scripts/dist/optimization/remove-unused-fonts.js
Line 24:
if (context.target === 'cordova') {

This adds a 2.3MB extra load of unused files in the final APK.

Steps to Reproduce:
ionic cordova build android
Rename created APK to zip and extract.
Check in assets/www/assets/fonts

My ionic info:

cli packages:

    @ionic/cli-utils  : 1.8.1
    ionic (Ionic CLI) : 3.8.1

global packages:

    Cordova CLI : 7.0.1

local packages:

    @ionic/app-scripts : 2.1.3
    Cordova Platforms  : android 6.2.3 browser 4.1.0 ios 4.4.0
    Ionic Framework    : ionic-angular 3.6.0

System:

    Android SDK Tools : 25.2.3
    ios-deploy        : 1.9.1
    ios-sim           : 5.1.0
    Node              : v6.11.2
    npm               : 5.3.0
    OS                : macOS Sierra
    Xcode             : Xcode 8.3.2 Build version 8E2002

bug

Most helpful comment

@sachingarg05 Thanks for reporting this. It went unnoticed for a while. CLI 3.9.2 will now correctly pass --platform and --target to the app-scripts build process.

All 4 comments

Same for context.platform, this is also set to null.

Who should set the context.target? Ionic CLI or @ionic/app-scripts?

Please note that the problem is with both context.platform and context.target. Both are needed by the code that optimizes the included fonts.

@sachingarg05 Thanks for reporting this. It went unnoticed for a while. CLI 3.9.2 will now correctly pass --platform and --target to the app-scripts build process.

Was this page helpful?
0 / 5 - 0 ratings