Skip to content

Commit

Permalink
[Doc][EventHubs,ServiceBus] Add information about bundling using Roll…
Browse files Browse the repository at this point in the history
…up (#23184)
  • Loading branch information
jeremymeng authored Sep 13, 2022
1 parent ac353f8 commit fa04a38
Show file tree
Hide file tree
Showing 2 changed files with 86 additions and 2 deletions.
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

```diff
+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

```diff
+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

0 comments on commit fa04a38

Please sign in to comment.