Skip to content

Commit fa04a38

Browse files
authored
[Doc][EventHubs,ServiceBus] Add information about bundling using Rollup (Azure#23184)
1 parent ac353f8 commit fa04a38

File tree

2 files changed

+86
-2
lines changed

2 files changed

+86
-2
lines changed

sdk/eventhub/event-hubs/README.md

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,9 @@ In addition to what is described there, this library also needs additional polyf
6161
- `path`
6262
- `process`
6363

64-
For example, if you are using Webpack v5, you can install the following dev dependencies
64+
#### Bundling with Webpack
65+
66+
If you are using Webpack v5, you can install the following dev dependencies
6567

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

@@ -95,6 +97,46 @@ then add the following into your webpack.config.js
9597
},
9698
```
9799

100+
#### Bundling with Rollup
101+
102+
If you are using Rollup bundler, install the following dev dependencies
103+
104+
- `npm install --save-dev buffer process @rollup/plugin-commonjs @rollup/plugin-inject @rollup/plugin-node-resolve`
105+
106+
Then include the following in your rollup.config.js
107+
108+
```diff
109+
+import nodeResolve from "@rollup/plugin-node-resolve";
110+
+import cjs from "@rollup/plugin-commonjs";
111+
+import shim from "rollup-plugin-shim";
112+
+import inject from "@rollup/plugin-inject";
113+
114+
export default {
115+
// other configs
116+
plugins: [
117+
+ shim({
118+
+ fs: `export default {}`,
119+
+ net: `export default {}`,
120+
+ tls: `export default {}`,
121+
+ path: `export default {}`,
122+
+ dns: `export function resolve() { }`,
123+
+ }),
124+
+ nodeResolve({
125+
+ mainFields: ["module", "browser"],
126+
+ preferBuiltins: false,
127+
+ }),
128+
+ cjs(),
129+
+ inject({
130+
+ modules: {
131+
+ Buffer: ["buffer", "Buffer"],
132+
+ process: "process",
133+
+ },
134+
+ exclude: ["./**/package.json"],
135+
+ }),
136+
]
137+
};
138+
```
139+
98140
Please consult the documentation of your favorite bundler for more information on using polyfills.
99141

100142
### Authenticate the client

sdk/servicebus/service-bus/README.md

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,9 @@ In addition to what is described there, this library also needs additional polyf
5858
- `path`
5959
- `process`
6060

61-
For example, if you are using Webpack v5, you can install the following dev dependencies
61+
#### Bundling with Webpack
62+
63+
If you are using Webpack v5, you can install the following dev dependencies
6264

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

@@ -92,6 +94,46 @@ then add the following into your webpack.config.js
9294
},
9395
```
9496

97+
#### Bundling with Rollup
98+
99+
If you are using Rollup bundler, install the following dev dependencies
100+
101+
- `npm install --save-dev buffer process @rollup/plugin-commonjs @rollup/plugin-inject @rollup/plugin-node-resolve`
102+
103+
Then include the following in your rollup.config.js
104+
105+
```diff
106+
+import nodeResolve from "@rollup/plugin-node-resolve";
107+
+import cjs from "@rollup/plugin-commonjs";
108+
+import shim from "rollup-plugin-shim";
109+
+import inject from "@rollup/plugin-inject";
110+
111+
export default {
112+
// other configs
113+
plugins: [
114+
+ shim({
115+
+ fs: `export default {}`,
116+
+ net: `export default {}`,
117+
+ tls: `export default {}`,
118+
+ path: `export default {}`,
119+
+ dns: `export function resolve() { }`,
120+
+ }),
121+
+ nodeResolve({
122+
+ mainFields: ["module", "browser"],
123+
+ preferBuiltins: false,
124+
+ }),
125+
+ cjs(),
126+
+ inject({
127+
+ modules: {
128+
+ Buffer: ["buffer", "Buffer"],
129+
+ process: "process",
130+
+ },
131+
+ exclude: ["./**/package.json"],
132+
+ }),
133+
]
134+
};
135+
```
136+
95137
Please consult the documentation of your favorite bundler for more information on using polyfills.
96138

97139
### Authenticate the client

0 commit comments

Comments
 (0)