Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

389
Views
Webpack 5+Process is not defined triggered by stream-browserify

I have to decode a CBOR encoded array using the cbor node module.

When i launch my command:

const decodedData = base45.decode(greenpassBody);
const output = pako.inflate(decodedData);
const results = cbor.decodeAllSync(output); // this line

this error is being triggered:

_stream_readable.js:529 Uncaught ReferenceError: process is not defined
    at emitReadable (_stream_readable.js:529)
    at addChunk (_stream_readable.js:303)
    at readableAddChunk (_stream_readable.js:280)
    at NoFilter.Readable.push (_stream_readable.js:241)
    at NoFilter.Transform.push (_stream_transform.js:139)
    at NoFilter._transform (index.js:220)
    at NoFilter.Transform._read (_stream_transform.js:177)
    at NoFilter.Transform._write (_stream_transform.js:164)
    at doWrite (_stream_writable.js:409)
    at writeOrBuffer (_stream_writable.js:398)

Triggered by the stram-browserify polyfill, necessary to use all of these packages in my web app.

As I read on web, I tried to install the process module in my package.json, then in my webpack config file i tryied in few ways:

fallback: {
  stream: require.resolve('stream-browserify'),
  util: require.resolve('util/'),
  zlib: require.resolve('browserify-zlib'),
  assert: require.resolve('assert/'),
  crypto: require.resolve('crypto-browserify'),
  fs: require.resolve('browserify-fs'),
  path: require.resolve('path-browserify'),
  process: require.resolve('process/browser'),  // <- this
}
alias: {
    'jquery-ui': path.resolve(__dirname, "./node_modules/jquery-ui"),
    'owl.carousel': path.resolve(__dirname, "./node_modules/owl.carousel"),
    modernizr$: path.resolve(__dirname, "./modernizrrc.js"),
    WOW: 'wowjs',
    process: "process/browser", // 1st try
    process: path.resolve(__dirname, "./node_modules/process/browser.js"), // 2nd try
},
    plugins: [
      // ...
      new webpack.DefinePlugin({
         process: "process/browser"
        "process.env": {
          ASSET_PATH: JSON.stringify(ASSET_PATH),
          NODE_ENV: JSON.stringify("development"),
          ENV: JSON.stringify("development"),
        },
      }),

With the DefinePlugin try, the error changed, it said browser is not defined.

Anyone knows how to correctly polyfill this module or if there are other ways to use the CBOR module?

Thanks so much

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

SOLVED

the problem was that the process plugin must be provided, not defined:

it's

new webpack.ProvidePlugin({
  process: 'process/browser',
})

not

new webpack.DefinePlugin({
  process: 'process/browser',
}),
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!