[solved] PWA to TWA for playstore need repeated task on every build



  • I have submitted my PWA as TWA on google playstore. This requires a folder ‘.well-known’ and a file inside this folder ‘asset-links.json’

    alt text

    How can I include this folder in my src so that it exists on every build command?



  • Install this package first https://www.npmjs.com/package/npm-run-all

    and use following scripts - ‘compress_sw’ is optional

    "postbuild": "run-s compress_sw mkdir_wellknown copyfile",
            "compress_sw": "terser --compress --mangle --output dist/pwa/service-worker.js -- dist/pwa/service-worker.js",
            "mkdir_wellknown": "mkdir -p /<path to directory>/dist/pwa/.well-known",
            "copyfile": "cp -r /<path to directory>/src/.well-known/assetlinks.json /<path to directory>/dist/pwa/.well-known/assetlinks.json",
            ```

Log in to reply