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

[Doc][EventHubs,ServiceBus] Add information about bundling using Rollup #23184

Merged
merged 2 commits into from
Sep 13, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 43 additions & 1 deletion sdk/eventhub/event-hubs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ In addition to what is described there, this library also needs additional polyf
- `path`
- `process`

For example, if you are using Webpack v5, you can install the following dev dependencies
#### Bundling with Webpack

If you are using Webpack v5, you can install the following dev dependencies

- `npm install --save-dev buffer os-browserify path-browserify process`

Expand Down Expand Up @@ -95,6 +97,46 @@ then add the following into your webpack.config.js
},
```

#### Bundling with Rollup

If you are using Rollup bundler, install the following dev dependencies

- `npm install --save-dev buffer process @rollup/plugin-commonjs @rollup/plugin-inject @rollup/plugin-node-resolve`

Then include the following in your rollup.config.js

```js
import nodeResolve from "@rollup/plugin-node-resolve";
import cjs from "@rollup/plugin-commonjs";
import shim from "rollup-plugin-shim";
import inject from "@rollup/plugin-inject";

export default {
// other configs
plugins: [
shim({
fs: `export default {}`,
net: `export default {}`,
tls: `export default {}`,
path: `export default {}`,
dns: `export function resolve() { }`,
}),
nodeResolve({
mainFields: ["module", "browser"],
preferBuiltins: false,
}),
cjs(),
inject({
modules: {
Buffer: ["buffer", "Buffer"],
process: "process",
},
exclude: ["./**/package.json"],
}),
]
};
```

Please consult the documentation of your favorite bundler for more information on using polyfills.

### Authenticate the client
Expand Down
44 changes: 43 additions & 1 deletion sdk/servicebus/service-bus/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ In addition to what is described there, this library also needs additional polyf
- `path`
- `process`

For example, if you are using Webpack v5, you can install the following dev dependencies
#### Bundling with Webpack

If you are using Webpack v5, you can install the following dev dependencies

- `npm install --save-dev buffer os-browserify path-browserify process`

Expand Down Expand Up @@ -92,6 +94,46 @@ then add the following into your webpack.config.js
},
```

#### Bundling with Rollup

If you are using Rollup bundler, install the following dev dependencies

- `npm install --save-dev buffer process @rollup/plugin-commonjs @rollup/plugin-inject @rollup/plugin-node-resolve`

Then include the following in your rollup.config.js

```js
import nodeResolve from "@rollup/plugin-node-resolve";
import cjs from "@rollup/plugin-commonjs";
import shim from "rollup-plugin-shim";
import inject from "@rollup/plugin-inject";

export default {
// other configs
plugins: [
shim({
fs: `export default {}`,
net: `export default {}`,
tls: `export default {}`,
path: `export default {}`,
dns: `export function resolve() { }`,
}),
nodeResolve({
mainFields: ["module", "browser"],
preferBuiltins: false,
}),
cjs(),
inject({
modules: {
Buffer: ["buffer", "Buffer"],
process: "process",
},
exclude: ["./**/package.json"],
}),
]
};
```

Please consult the documentation of your favorite bundler for more information on using polyfills.

### Authenticate the client
Expand Down