From 4d19e60bbf6cdf58300b019ee82284d01972566f Mon Sep 17 00:00:00 2001 From: Jeremy Meng Date: Mon, 12 Sep 2022 18:10:22 +0000 Subject: [PATCH 1/2] [EventHubs,ServiceBus] Add information about bundling using Rollup --- sdk/eventhub/event-hubs/README.md | 44 +++++++++++++++++++++++++++- sdk/servicebus/service-bus/README.md | 44 +++++++++++++++++++++++++++- 2 files changed, 86 insertions(+), 2 deletions(-) diff --git a/sdk/eventhub/event-hubs/README.md b/sdk/eventhub/event-hubs/README.md index 7d4cc2196882..9bf60032d474 100644 --- a/sdk/eventhub/event-hubs/README.md +++ b/sdk/eventhub/event-hubs/README.md @@ -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` @@ -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 diff --git a/sdk/servicebus/service-bus/README.md b/sdk/servicebus/service-bus/README.md index be38e679932b..56ccdbfe7c25 100644 --- a/sdk/servicebus/service-bus/README.md +++ b/sdk/servicebus/service-bus/README.md @@ -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` @@ -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 From e524a81faa2c58a0d4fae75190b60840c702e5dd Mon Sep 17 00:00:00 2001 From: Jeremy Meng Date: Tue, 13 Sep 2022 20:07:51 +0000 Subject: [PATCH 2/2] appear eslint --- sdk/eventhub/event-hubs/README.md | 48 ++++++++++++++-------------- sdk/servicebus/service-bus/README.md | 48 ++++++++++++++-------------- 2 files changed, 48 insertions(+), 48 deletions(-) diff --git a/sdk/eventhub/event-hubs/README.md b/sdk/eventhub/event-hubs/README.md index 9bf60032d474..f8850fbeac26 100644 --- a/sdk/eventhub/event-hubs/README.md +++ b/sdk/eventhub/event-hubs/README.md @@ -105,34 +105,34 @@ If you are using Rollup bundler, install the following dev dependencies 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"; +```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"], - }), ++ 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"], ++ }), ] }; ``` diff --git a/sdk/servicebus/service-bus/README.md b/sdk/servicebus/service-bus/README.md index 56ccdbfe7c25..62216ba8c96f 100644 --- a/sdk/servicebus/service-bus/README.md +++ b/sdk/servicebus/service-bus/README.md @@ -102,34 +102,34 @@ If you are using Rollup bundler, install the following dev dependencies 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"; +```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"], - }), ++ 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"], ++ }), ] }; ```