pinojs / pino-webpack-plugin

MIT License
19 stars 9 forks source link

Plugin is not working with webpack cache #3

Closed artem-malko closed 2 years ago

artem-malko commented 2 years ago

Hi! Thx for the plugin, it helps a lot to use pino with typescript in production code. But there is a problem with a cache. If you will add:

cache: {
        name: 'test',
        type: 'filesystem',
        buildDependencies: {
          config: [__filename]
        }
      },

to your webpack config, the first test will be ok, but the second will fail. The problem is, that plugin won't be executed, if webpack uses a code from cache. And I do not know, how to fix it(

Of course, I can use in memory cache, but the first build will take much time.

By the way, in memory cache will break the code too. If I change a transport — I will see an error:

logServerUncaughtException error:  Error: The worker thread exited
    at Worker.onWorkerExit (/Users/a.malko/Work/react-ssr-template/build/main.js:95787:32)
    at Worker.emit (node:events:390:28)
    at Worker.[kOnExit] (node:internal/worker:278:10)
    at Worker.<computed>.onexit (node:internal/worker:198:20)
/Users/a.malko/Work/react-ssr-template/build/main.js:95821
      throw new Error('the worker has exited')
      ^

Error: the worker has exited
    at ThreadStream.write (/Users/a.malko/Work/react-ssr-template/build/main.js:95821:13)
    at Pino.write (/Users/a.malko/Work/react-ssr-template/build/main.js:99370:10)
    at Pino.LOG [as error] (/Users/a.malko/Work/react-ssr-template/build/main.js:99677:21)
    at logServerUncaughtException (/Users/a.malko/Work/react-ssr-template/build/main.js:10882:66)
    at process.<anonymous> (/Users/a.malko/Work/react-ssr-template/build/main.js:101485:133)
    at process.emit (node:events:390:28)
    at process._fatalException (node:internal/process/execution:170:25)
artem-malko commented 2 years ago

By the way, I can not understand, why it is not possible to use just BannerPlugin? I've tried to use it, but I have an error:

the worker has exited
mcollina commented 2 years ago

Would you like to send a Pull Request to address this issue?

artem-malko commented 2 years ago

@mcollina the pull request with the bug, right?

artem-malko commented 2 years ago

@mcollina And it's done)

mcollina commented 2 years ago

With the fix too!

artem-malko commented 2 years ago

Sorry, I do not know, how to fix it(