Skip to content

Webpack 5 - TypeError: Super expression must either be null or a function #1270

Open

Description

@swisscat

The issue can be reproduced with the following repository: https://github.com/swisscat/webpack-jsforce-test

  • npm install
  • npx webpack
  • Open dist/index.html in a browser to reproduce the issue

Notes:

  • Solved issues about querystring/buffer/process
  • Tried to use terser plugins without success
  • This is not related to React (See the repo's dependencies, and the src/index.js)

Webpack config:

const webpack = require('webpack');

module.exports = {
    mode: 'development',
    resolve: {
        fallback: {
            buffer: false,
            stream: false,
            util: false,
            querystring: false,
            timers: false,
        }
    },
    plugins: [
        new webpack.ProvidePlugin({
            Buffer: ['buffer', 'Buffer'],
            process: 'process/browser',
        }),
    ]
}

Regards,

Activity

  1. sashavmorozov commented on Mar 17, 2024

    @sashavmorozov

    I am creating an Excel plugin and trying to use jsforce (bundling with webpack), getting the same error. Was anyone successful resolving it?

    index.js:43
    Uncaught TypeError: Super expression must either be null or a function
    at _inherits (index.js:43:107)
    at index.js:92:1
    at ./node_modules/csv-parse/lib/es5/index.js (index.js:1386:2)
    at webpack_require (bootstrap:22:1)
    at fn (hot module replacement:61:1)
    at ./node_modules/jsforce/lib/csv.js (csv.js:4:16)
    at webpack_require (bootstrap:22:1)
    at fn (hot module replacement:61:1)
    at ./node_modules/jsforce/lib/record-stream.js (record-stream.js:15:14)
    at webpack_require (bootstrap:22:1)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions