## Bundling Chime SDK into a single .js file This demo shows how to bundle the latest release of `amazon-chime-sdk-js` into a single JS file using Rollup. You'll need to have Node 14+ and npm 6.11+ on your local development machine. ```bash git clone https://github.com/aws-samples/amazon-chime-sdk.git cd amazon-chime-sdk/utils/singlejs npm install npm run bundle ``` It will generate `amazon-chime-sdk.min.js` and `amazon-chime-sdk.min.js.map` in the `build` folder. Include both files in your project and embed `amazon-chime-sdk.min.js`. ```html ``` ### Using ChimeSDK In a browser environment, `window.ChimeSDK` will be available. You can access Chime SDK components by component name ([See the full list here](https://github.com/aws/amazon-chime-sdk-js/blob/master/src/index.ts)). For example, you can [create a meeting session](https://aws.github.io/amazon-chime-sdk-js/modules/apioverview.html#1-create-a-session) and [configure the meeting session](https://aws.github.io/amazon-chime-sdk-js/modules/apioverview.html#2-configure-the-session) using `window.ChimeSDK`. ```js const logger = new ChimeSDK.ConsoleLogger('ChimeMeetingLogs', ChimeSDK.LogLevel.INFO); const deviceController = new ChimeSDK.DefaultDeviceController(logger); const configuration = new ChimeSDK.MeetingSessionConfiguration(meeting, attendee); const meetingSession = new ChimeSDK.DefaultMeetingSession(configuration, logger, deviceController); ``` ### Changing target version You can change the version of `amazon-chime-sdk-js` in `package.json`. By default, `npm run bundle` uses the version of the SDK that is defined in the package. To bundle a specific version of the SDK, delete any build folder that was generated by a previous `npm run bundle` command, and then run `npm install amazon-chime-sdk-js@x.xx.xx` and specify the version of the SDK that you'd like to install. Then, run `npm run bundle` to generate the bundled SDK. ```json "dependencies": { "amazon-chime-sdk-js": "^3.12.0" } ```