Www/index.html get reverted back to a blank default version


#1

How do you explain it when my www/index.html file and my src/index.html file are the same, my custom code, but when I do a ionic cordova build ios, the www/index.html get reverted back to a blank default version? If it was going to take it from my src/index.html, it would be correct, but I have no idea where it’s getting this basic file from as the one in src is still correct. it is frustrating, hard to tell if my build has good code or not.


Changes made to index.html erased after build
#2

What is your ionic info output?
What exact command are you using to build?


#3

Would it matter? The src/index.html and the www/index.html are the same. Where is it getting the old code from?
I am not positive, but I this it mostly happens when I use:

ionic build

This is happening on a project that I have moved code over from an existing project, I moved my code into the www folder as per the instructions when I exported it from Creator. Once I saw that it was copying the src/index.html stuff into www, I modified the src file to make sure that it was correct, did not help, once it even overwrote both files and set them back to a default state!


#4

You still didn’t post your ionic info output.


#5

cli packages: (/usr/local/lib/node_modules)

@ionic/cli-utils  : 1.13.1
ionic (Ionic CLI) : 3.13.2

global packages:

cordova (Cordova CLI) : 6.5.0 

local packages:

@ionic/app-scripts : 3.0.0
Cordova Platforms  : android 6.1.2 ios 4.3.1
Ionic Framework    : ionic-angular 3.7.1

System:

ios-deploy : 1.9.2 
Node       : v6.11.0
npm        : 3.10.10 
OS         : macOS Sierra
Xcode      : Xcode 9.0 Build version 9A235 

Misc:

backend : pro

#6

You should get these updated.

These instructions were clearly wrong for an Ionic 2+ project. You never change things in www manually.

How are you running the app after ionic build to see the problem?


#7

This was an app that was created with Ionic Creator and moved to my local drive to do final edits using the zip export from Creator. The directions said to place the code in the www folder. Once I build the app I use xcode to package it up and run it on my iPad or I do cordova run android --device to run it on my android tablet. The process works most of the time. Modifying the code in www works, no problems, except this that only happens after I do a “ionic build”, if I do a cordova build ios I don’t seem to have the issue.


#8

Are you sure this is an Ionic 2+ project then? For these projects this would be 100% wrong.

If its an Ionic v1 project, create one with the CLI and you will only have the www folder and everything will work out of the box.

This is not an ionic command, so of course it doesn’t do anything to the build. This only takes whatever is in www and copies it over to the Cordova project.


#9

Then their instructions are ambiguous at best, they need to clean up their documentation now that they have multiple versions of their app that you can create.

Thanks for your assistance, I am about to publish to the stores, I think I am stable for now.