pino-webpack-plugin
pino-webpack-plugin copied to clipboard
runtime error -- TypeError: fastCopy is not a function
followed the instructions and I am able to run webpack with plugin. I see all the pino files getting added to dist directory webpack version: 5.74.0
However when I start the app I get error
TypeError: fastCopy is not a function
at filterLog (webpack://core-api/../node_modules/pino-pretty/lib/utils.js?:581:19)
at pretty (webpack://core-api/../node_modules/pino-pretty/index.js?:139:13)
at Transform.transform [as _transform] (webpack://core-api/../node_modules/pino-pretty/index.js?:231:22)
at Transform._write (webpack://core-api/../node_modules/readable-stream/lib/internal/streams/transform.js?:168:8)
at writeOrBuffer (webpack://core-api/../node_modules/readable-stream/lib/internal/streams/writable.js?:341:12)
at _write (webpack://core-api/../node_modules/readable-stream/lib/internal/streams/writable.js?:283:10)
at Transform.Writable.write (webpack://core-api/../node_modules/readable-stream/lib/internal/streams/writable.js?:287:10)
at Transform.ondata (node:internal/streams/readable:754:22)
at Transform.emit (node:events:513:28)
at addChunk (node:internal/streams/readable:315:12)
this is my webpack config
// Generated using webpack-cli https://github.com/webpack/webpack-cli
const { PinoWebpackPlugin } = require('pino-webpack-plugin');
const path = require('path');
const isProduction = process.env.NODE_ENV == 'production';
const config = {
entry: './src/fastify-handler.ts',
target: 'node',
watch: true,
plugins: [ new PinoWebpackPlugin({ transports: [ 'pino-pretty' ] }) ],
externals: [
{
'fastify-swagger': 'commonjs2 fastify-swagger',
'pg-native': 'commonjs2 pg-native',
'react-native-sqlite-storage': 'react-native-sqlite-storage',
mssql: 'mssql',
sqlite3: 'sqlite3',
'sql.js': 'sql.js',
'better-sqlite3': 'better-sqlite3',
ioredis: 'ioredis',
redis: 'redis',
'typeorm-aurora-data-api-driver': 'typeorm-aurora-data-api-driver',
'pg-query-stream': 'pg-query-stream',
oracledb: 'oracledb',
mysql2: 'mysql2',
mysql: 'mysql',
'hdb-pool': 'hdb-pool',
'@sap/hana-client': '@sap/hana-client',
mongodb: 'mongodb',
'@google-cloud/spanner': '@google-cloud/spanner',
},
],
output: {
path: path.resolve(__dirname, 'dist'),
// filename: 'core-api.js',
library: { name: 'core-api', type: 'umd' }, // see https://webpack.js.org/guides/author-libraries/
},
devServer: {
open: true,
host: 'localhost',
},
module: {
rules: [
{
test: /\.(ts|tsx)$/i,
loader: 'ts-loader',
// exclude: [ '/node_modules/' ],
},
{
test: /\.(eot|svg|ttf|woff|woff2|png|jpg|gif)$/i,
type: 'asset',
},
// Add your rules for custom modules here
// Learn more about loaders from https://webpack.js.org/loaders/
],
},
resolve: {
extensions: [ '.tsx', '.ts', '.jsx', '.js', '...', 'json' ],
},
};
module.exports = () => {
if (isProduction) {
config.mode = 'production';
} else {
config.mode = 'development';
}
return config;
};