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

fix: use workaround loading process-shim for browserify #497

Merged
merged 1 commit into from Jan 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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.