Search code examples
reactjsfontsmanifestcreate-react-app

Manifest and couple of other static files (fonts) not found after npm run build


Manifest and couple of other static files (fonts) not found after npm run build.

The app was created by create-react-app.

In the public/index.html <link rel="manifest" href="%PUBLIC_URL%/manifest.json">

Files appear in the build folder and successfully deploys. I can find them using Azure Kudu services. favicon.ico and other static elements work well. There is an issue only with manifest and two fonts.

For local run : "app:start": "react-app-env --env-file=dev.env start" "start": "npm run app:start"

For the build : "app:dev": "react-app-env --env-file=dev.env build" "build": "npm run semantic:build && npm run app:build" "semantic:build": "gulp build --gulpfile ./src/semantic/gulpfile.js"

GET https://public.url/manifest.json 404

Manifest: Line: 1, column: 1, Syntax error.

GET https://public.url/static/media/icons.af7ae505.woff2 net::ERR_ABORTED 404

GET https://public.url/static/media/icons.fee66e71.woff net::ERR_ABORTED 404


Solution

  • Was fixed. Added piece of code to the public/web.config :

    <staticContent>
                <remove fileExtension=".json" />
                <mimeMap fileExtension=".json" mimeType="application/json" />
                <remove fileExtension=".woff" />
                <mimeMap fileExtension=".woff" mimeType="application/font-woff" />
                <remove fileExtension=".woff2" />
                <mimeMap fileExtension=".woff2" mimeType="font/x-woff" />
    </staticContent>