node-util icon indicating copy to clipboard operation
node-util copied to clipboard

Uncaught RangeError: Wrong length!

Open Ankur-Marwaha opened this issue 3 years ago • 0 comments

Hi,

As per my understanding, when using webpack ^5.0.0 version, we need to install utils manually and include it in fallback. Like this

module.exports = {
  devtool: 'source-map',
  entry: entries,
  output: {
    path: PATHS.outputFolder,
    library: {
      type: 'var',
      name: 'Library'
    },
    filename: PATHS.outputFileName
  },
  mode: ENVIRONMENT,
  resolve: {
    extensions: ['.js', '.jsx'],
    fallback: {
      stream: false,
      path: false,
      zlib: false,
      crypto: false,
      util: require.resolve('util/')                    //SEE THIS
    }
  },
  module: {
    rules: [babelLoader, combinedStyleLoader, rawCSSLoader]
  },
  plugins: [
    new webpack.IgnorePlugin({ resourceRegExp: /^\.\/locale$/, contextRegExp: /moment$/ }),
    new webpack.ProvidePlugin({ process: 'process/browser', Buffer: ['buffer', 'Buffer'] })                       //SEE THIS
  ]
};

But after doing that The project builds and while running the localhost in browser - I am getting the following error. - (which seems to be related to this package only)

    at $ (polyfill.min.js:2:6057)
    at new ArrayBuffer (polyfill.min.js:2:6174)
    at Object../node_modules/util/support/types.js (types.js:296:1)
    at __webpack_require__ (bootstrap:19:1)
    at Object../node_modules/util/util.js (util.js:467:1)
    at __webpack_require__ (bootstrap:19:1)
    at Object../node_modules/jws/lib/data-stream.js (data-stream.js:4:12)
    at __webpack_require__ (bootstrap:19:1)
    at Object../node_modules/jws/lib/sign-stream.js (sign-stream.js:3:18)
    at __webpack_require__ (bootstrap:19:1)

Tried different versions of Utils package - no success

is there any resolution ? or Any alternate way that i can try some other package or something ?

Ankur-Marwaha avatar Jun 17 '22 08:06 Ankur-Marwaha