What happened to the manifest.json in Ionic 4

I worked it out, by employing a before_prepare hook, which copies the /src/manifest.json file to /www. As the www folder gets recreated on every run, this seems like the only solution - for the moment.

This is the hook I used:

#!/usr/bin/env node

var FILES_TO_COPY = [{
    srcPath: "src/manifest.json",
    destPath: "www/manifest.json"
}];

var fs = require('fs');
var path = require('path');

function copyFileSync(srcFile, target) {
    var destFile = target;

    console.log('copying ' + srcFile + ' to ' + destFile);

    if (fs.existsSync(target)) {
        if (fs.lstatSync(target).isDirectory()) {
            destFile = path.join(target, path.basename(srcFile));
        }
    }

    fs.writeFileSync(destFile, fs.readFileSync(srcFile));
}

FILES_TO_COPY.forEach(function (fileInfo) {
    copyFileSync(fileInfo.srcPath, fileInfo.destPath);
});

Put it in a .js file (you can change the filename, not the ending) in a new /hooks folder and then plug it into your config.xml file:

<hook src="hooks/10_copy_manifest_hook.js" type="before_prepare" />

Hope it helps someone…

6 Likes