A pino plugin for webpack.
Just run:
npm install pino-webpack-plugin
This plugin allows to use of pino v7 with webpack generated bundle files.
Note that, due to pino architecture (based on Node.js' Worker Threads), it is not possible to make it work without generating extra files.
This means that when using this plugin the following list of files will be generated at the root of your dist folder:
thread-stream.js
pino-worker.js
pino-pipeline-worker.js
pino-file.js
- A file for each transport you specify in the plugin constructor's
transports
option. (see below)
Each of the additional file is a bundle and therefore does not contain any external dependency, but it is needed to use pino and it must be included in the deployment.
Simply include the plugin in your webpack configuration.
Make sure you provide the plugin a list of all the pino transports you use via the transports
option (pino/file
is always included so no need to specify it).
const { PinoWebpackPlugin } = require('pino-webpack-plugin')
module.exports = {
entry: 'index.js',
plugins: [new PinoWebpackPlugin({ transports: ['pino-pretty'] })]
}
See CONTRIBUTING.md
Copyright Paolo Insogna and pino-webpack-plugin contributors 2021. Licensed under the MIT License.