Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

runtime error -- TypeError: fastCopy is not a function #68

Open
bmccann36 opened this issue Oct 21, 2022 · 4 comments
Open

runtime error -- TypeError: fastCopy is not a function #68

bmccann36 opened this issue Oct 21, 2022 · 4 comments

Comments

@bmccann36
Copy link

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;
};
@mcollina
Copy link
Member

@ShogunPanda ptal

@ShogunPanda
Copy link
Collaborator

I tried to reproduce locally using a trimmed version but I'm not able to.
@bmccann36 Can you please provide a reproducible repo to use? Also, how are you running webpack and then execute the bundled file?

@ROISoftware
Copy link

I am experiencing the same error TypeError: fastCopy is not a function error

@ShogunPanda
Copy link
Collaborator

@ROISoftware Can you please provide a reproducible repo?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants