Cordova Slack Digest

Sat, 10 Sep 2022 08:21:54 GMT

User count: 4698

Join the conversation at slack.cordova.io

Channel #cordova-ios (2 messages)


Fri, 09 Sep 2022 18:53:52 GMT

@ironman4119 says

Finding something strange in the iOS build procedure (after platform rm and then add). If I do not remove the www folder in root it keeps compiling the old version

Trying to solve and understand what is happening here.

Manual algorithm to assure that our code from src makes it to ios & android at build time;

  1. cordova platform rm android ios
  2. Remove the www folder form root (not form src)
  3. ./hooks/prepare-www-folder.sh
  4. cordova platform add android ios@latest

Only then code changes to /src/www/ makes it to ios/www or android/www

so: Now figured how to be 100% sure the code we modify is in the src/www

Concluding that deviceReady is firing by running the following test ;

(function initialize() { import(‘./main.js’) .then(({ initAppBeforeDeviceReady }) => { initAppBeforeDeviceReady(); }) .catch(err => { document.addEventListener(‘deviceready’, () => { alert('IT IS READY '); }, false);

        console.log(`error importing main.js:`, err);
        alert(`error importing main.js: ${JSON.stringify(err)}`);
    });

})();

Tested including app directly, overriding main.js (error above) - same result and no err messages Conclusion; something is wrong in textras.cordova.funcs.js (but no err's so far ... ) did not expect this to be that convoluted. I think the upgrades that solve UIWebView may have caused things to break down.

Any idea here? Thank you.

Fri, 09 Sep 2022 19:07:35 GMT

@norman137 says

Cordova by default (and I dont know if this is actually configurable or not) will package everything under <cordova-project-root>/www as web assets for the application.

I think it may do copying steps during the prepare step so as long as you place your www files before cordova “prepares”, your web assets should be packaged up.

Personally I use bash scripts to call on series of other steps like webpack or whatever to build the www assets which is done before I even call any cordova commands.