Creatiwity / gatsby-plugin-favicon

UNMAINTAINED - Favicon Gatsby plugin
MIT License
166 stars 27 forks source link

Build fails when emitStats is false #54

Closed FMCorz closed 5 years ago

FMCorz commented 5 years ago

It seems that disabling emitStats causes the build to fail. Here is my config:

    {
      resolve: `gatsby-plugin-favicon`,
      options: {
        ...
        emitStats: false,
      },
    },

And here is the error that occurs on a fresh build.

info bootstrap finished - 7.182 s

success onPostBootstrap — 0.002 s
error UNHANDLED REJECTION

  Error: ENOENT: no such file or directory, open 'PROJECTDIR/public/.iconstats.json'

  - render-page.js:1735 Object../node_modules/gatsby-plugin-favicon/gatsby-ssr.js.module.exports.onRenderBody
    PROJECTDIR/public/render-page.js:1735:31

  - render-page.js:157 
    PROJECTDIR/public/render-page.js:157:36

  - Array.map

  - render-page.js:152 ./.cache/api-runner-ssr.js.module.exports
    PROJECTDIR/public/render-page.js:152:25

  - render-page.js:552 Module../.cache/develop-static-entry.js.__webpack_exports__.default
    PROJECTDIR/public/render-page.js:552:57

  - worker.js:35 Promise
    [website]/[gatsby]/dist/utils/worker.js:35:36

  - debuggability.js:313 Promise._execute
    [website]/[bluebird]/js/release/debuggability.js:313:9

  - promise.js:483 Promise._resolveFromExecutor
    [website]/[bluebird]/js/release/promise.js:483:18

  - promise.js:79 new Promise
    [website]/[bluebird]/js/release/promise.js:79:10

  - worker.js:31 Promise.map.path
    [website]/[gatsby]/dist/utils/worker.js:31:37

  - util.js:16 tryCatcher
    [website]/[bluebird]/js/release/util.js:16:23

  - map.js:61 MappingPromiseArray._promiseFulfilled
    [website]/[bluebird]/js/release/map.js:61:38

  - promise_array.js:114 MappingPromiseArray.PromiseArray._iterate
    [website]/[bluebird]/js/release/promise_array.js:114:31

  - promise_array.js:78 MappingPromiseArray.init
    [website]/[bluebird]/js/release/promise_array.js:78:10
julien1619 commented 5 years ago

Indeed it's failing because we rely on this file to generate favicon links in HTML files. Is there a use case which needs you to disable this file?

FMCorz commented 5 years ago

Not really, but I saw it as a configurable setting and got surprised when disabling it lead to errors. I supposed I tried turning it off because I wasn't a fan of that file being published in the public directory.

julien1619 commented 5 years ago

Yes, I understand, and I'm not a fan of that solution too but it's the only one I found to communicate data between every part of the process to make it work.

If you can figure another one, I would be very pleased to study it ;)

I'm closing this issue for now, feel free to open a new one if you have any idea on how to improve this specific point.