Skip to content

Files

Latest commit

 

History

History

Building the browser script version of AWS SDK for JS v3

This module bundles the AWS SDK v3 clients into a single JavaScript file that can be imported in a <script> tag, similar to how AWS SDK v2 worked.

Installation

Before building, ensure you have Node.js installed.

1. Install Dependencies

Run the following command in this directory:

npm install

2. Build the SDK

Generate the bundled JavaScript file by running:

npm run build

This creates the file:

dist/aws-sdk-VERSION-kvswebrtc.js

Note

VERSION will be replaced with the bundled AWS SDK version. For example: 3.758.0

Usage in HTML

Once built, include the script in your HTML file:

<script src="dist/aws-sdk-VERSION-kvswebrtc.js"></script>

After that, the AWS object is globally available, just like AWS SDK v2.

Note

AWS SDK for JS v3 uses different syntax than v2. Refer to the documentation for the syntax and usage.

Updating the AWS SDK for JS v3 to the latest

If you need to update the AWS SDK clients, modify package.json and run:

npm update

Then, rebuild the bundle:

npm run build

You can now move it to the examples to use it:

mv ./dist/aws-sdk-*-kvswebrtc.js ../examples

Note

You will also need to modify the <script> import in examples/index.html to pull the new file.

Troubleshooting

  • If npm run build fails, try deleting node_modules and package-lock.json, then reinstall:
    rm -rf node_modules package-lock.json
    npm install
  • Ensure Webpack is installed by running:
    npx webpack -v