I tried cordova-uglify
(link) to minify a Ionic1 project, after I run
ionic cordova build --release
I see my js source code in www
folder of app-release-unsigned.apk
.. is not minified at all.
ionic info
prints:
[WARN] Error with .\www\lib\ionic\version.json file: FILE_NOT_FOUND, trying
.\bower.json.
cli packages: (C:\Program Files\nodejs\node_modules)
@ionic/cli-utils : 1.19.1
ionic (Ionic CLI) : 3.19.1
global packages:
cordova (Cordova CLI) : 8.0.0
Gulp CLI : not installed globally
local packages:
Cordova Platforms : android 7.0.0 ios 4.5.4
Ionic Framework : ionic1 1.3.4
System:
Android SDK Tools : 26.0.1
Node : v8.9.4
npm : 5.6.0
OS : Windows 7
Edit: I noticed when I run ionic cordova build --release
I get those errors:
An error ocurred while reading directories:
Error: ENOENT: no such file or directory, scandir 'C:\nodejs\myproject\platforms\android\assets\www\js'
An error ocurred while reading directories:
Error: ENOENT: no such file or directory, scandir 'C:\nodejs\myproject\platforms\android\assets\www\css'
An error ocurred while reading directories:
Error: ENOENT: no such file or directory, scandir 'C:\nodejs\myproject\platforms\android\assets\www\img'
Running command: "C:\Program Files\nodejs\node.exe" C:\nodejs\myproject\hooks\after_prepare\uglify.js C:\nodejs\myproject
processFiles err: Error: ENOENT: no such file or directory, scandir 'C:\nodejs\myproject\platforms\android\assets\www\js'
processFiles err: Error: ENOENT: no such file or directory, scandir 'C:\nodejs\myproject\platforms\android\assets\www\css'
processFiles err: Error: ENOENT: no such file or directory, scandir 'C:\nodejs\myproject\platforms\android\assets\www\img'
processFiles err: Error: ENOENT: no such file or directory, scandir 'C:\nodejs\myproject\platforms\android\assets\www\build'
I do not have a .\platforms\android\assets\www
folder
@Antonis Those are the steps I tried:
npm install
npm rebuild node-sass --force
ionic cordova build --release
ENOENT: no such file or directory, scandir C:\nodejs\myproject\platforms\android\assets\www\js [...]
How can I generate that assets
folder?
I see there is an assets folder in .\platforms\android\app\src\main\assets
but the module ionic-minify search for .\platforms\android\assets
I noticed I have an assets folder in platforms\android\app\src\main\assets
so I edited .\hooks\after_prepare\uglify.js
and
.\hooks\after_prepare\010_add_platform_class.js
to match that path. It looks like it works now.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With