Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Manifest.json not copied to dist

Tags:

angular

pwa

My Angular project's purpose is to achieve "add to homescreen" mobile functionality. In that process I choose manifest/PWA methodology and I have created manifest.json in the root folder of project on the same level of index.html(root template), and added the manifest.json in the head section of root template (index.html) with following statement: . But upon "ng build" I see the manifest file not copied to the dist and as a result it's displays the following errors on clicking "add to homescreen" in "dev tools->application->manifest"

Angular is running in the development mode. Call enableProdMode() to enable the production mode. looking out for help!

**localhost/:1 GET http://localhost:4200/src/manifest.json 404 (Not Found)
manifest.json:1 Manifest: Line: 1, column: 1, Unexpected token.**

below is manifest file:

{
  "short_name": "Bus Express",
  "name": "BusEx",
  "start_url": "/",
  "background_color": "#ffffff",
  "display": "standalone",
  "scope": "/",
  "theme_color": "#fff",
  "icons": [
    {
      "src": "/assets/images/rateexpress128.png",
      "type": "image/png",
      "sizes": "128x128"
    },
    {
      "src": "/assets/images/rateexpress144.png",
      "type": "image/png",
      "sizes": "144x144"
    }
  ]
}
like image 721
Yespie Avatar asked Jun 21 '18 20:06

Yespie


People also ask

Where should manifest JSON be located?

First check if manifest. json is applied in the browser. For that open developer window by pressing shortcut F12. In Application tab, click Manifest option and see if it displays information that you have set.

Is manifest JSON necessary?

The manifest. json provides information about a web application in a JSON text file, necessary for the web app to be downloaded and be presented to the user similarly to a native app (e.g., be installed on the homescreen of a device, providing users with quicker access and a richer experience).

What is manifest JSON in angular?

The web app manifest provides information about an application (such as name, author, icon, and description) in a JSON text file. The purpose of the manifest is to install web applications to the homescreen of a device, providing users with quicker access and a richer experience.

What should be included in manifest JSON?

Using manifest. json , you specify basic metadata about your extension such as the name and version, and can also specify aspects of your extension's functionality (such as background scripts, content scripts, and browser actions).


1 Answers

Files are not copied by default to the dist folder. You need to add them manually in the angular.json config file (if Angular version >= 6) in the assets option, see here for an example or in the .angular-cli.json config file (if Angular version < 6), see here for an example.

like image 80
Guillaume Avatar answered Nov 13 '22 20:11

Guillaume