Skip to content

Commit

Permalink
fix: use workaround loading process-shim for browserify (#497)
Browse files Browse the repository at this point in the history
  • Loading branch information
bergos committed Jan 1, 2023
1 parent 6efcd35 commit b733ae5
Show file tree
Hide file tree
Showing 10 changed files with 9 additions and 32 deletions.
22 changes: 1 addition & 21 deletions README.md
Expand Up @@ -87,27 +87,7 @@ shown in the example above.

## Usage In Browsers

You will need a bundler like [`browserify`](https://github.com/browserify/browserify#readme), [`webpack`](https://webpack.js.org/), [`parcel`](https://github.com/parcel-bundler/parcel#readme) or similar. With Webpack 5 (which unlike other bundlers does not polyfill Node.js core modules and globals like `process`) you will also need to:

1. Install polyfills by running `npm install buffer process --save-dev`
2. Create a [`webpack.config.js`](https://webpack.js.org/guides/getting-started/#using-a-configuration) file containing:

```js
const webpack = require('webpack')

module.exports = {
plugins: [
new webpack.ProvidePlugin({
process: 'process/browser'
})
],
resolve: {
fallback: {
buffer: require.resolve('buffer/')
}
}
}
```
You will need a bundler like [`browserify`](https://github.com/browserify/browserify#readme), [`webpack`](https://webpack.js.org/), [`parcel`](https://github.com/parcel-bundler/parcel#readme) or similar. Polyfills are no longer required since version 4.2.0.

# Streams Working Group

Expand Down
2 changes: 1 addition & 1 deletion build/headers.mjs
Expand Up @@ -9,7 +9,7 @@ const bufferRequire = `
const processRequire = `
/* replacement start */
const process = require('process')
const process = require('process/')
/* replacement end */
`
Expand Down
2 changes: 1 addition & 1 deletion lib/internal/streams/destroy.js
Expand Up @@ -2,7 +2,7 @@

/* replacement start */

const process = require('process')
const process = require('process/')

/* replacement end */

Expand Down
2 changes: 1 addition & 1 deletion lib/internal/streams/duplexify.js
@@ -1,6 +1,6 @@
/* replacement start */

const process = require('process')
const process = require('process/')

/* replacement end */

Expand Down
2 changes: 1 addition & 1 deletion lib/internal/streams/end-of-stream.js
@@ -1,6 +1,6 @@
/* replacement start */

const process = require('process')
const process = require('process/')

/* replacement end */
// Ported from https://github.com/mafintosh/end-of-stream with
Expand Down
2 changes: 1 addition & 1 deletion lib/internal/streams/from.js
Expand Up @@ -2,7 +2,7 @@

/* replacement start */

const process = require('process')
const process = require('process/')

/* replacement end */

Expand Down
2 changes: 1 addition & 1 deletion lib/internal/streams/pipeline.js
@@ -1,6 +1,6 @@
/* replacement start */

const process = require('process')
const process = require('process/')

/* replacement end */
// Ported from https://github.com/mafintosh/pump with
Expand Down
2 changes: 1 addition & 1 deletion lib/internal/streams/readable.js
@@ -1,6 +1,6 @@
/* replacement start */

const process = require('process')
const process = require('process/')

/* replacement end */
// Copyright Joyent, Inc. and other Node contributors.
Expand Down
2 changes: 1 addition & 1 deletion lib/internal/streams/writable.js
@@ -1,6 +1,6 @@
/* replacement start */

const process = require('process')
const process = require('process/')

/* replacement end */
// Copyright Joyent, Inc. and other Node contributors.
Expand Down
3 changes: 0 additions & 3 deletions process

This file was deleted.

0 comments on commit b733ae5

Please sign in to comment.