Skip to content

Commit

Permalink
Drop UMD bundle (#193)
Browse files Browse the repository at this point in the history
  • Loading branch information
frederikprijck committed Aug 15, 2023
1 parent 8565b45 commit 506ce6c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 28 deletions.
19 changes: 4 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,26 +92,15 @@ const { jwtDecode } = require('jwt-decode');

#### Include with a script tag

Copy the file `jwt-decode.js` from the root of the `build/` folder to your project somewhere, then include it like so:
Copy the file `jwt-decode.js` from the root of the `build/esm` folder to your project somewhere, then import `jwtDecode` from it inside a script tag that's marked with `type="module"`:

```html
<script src="jwt-decode.js"></script>
```

Once this script has loaded, the `jwt_decode` function will be exposed as a global:

```javascript
const token = "eyJhsw5c";
const decoded = jwt_decode(token);
```
<script type="module">
import { jwtDecode } from "/path/to/jwt-decode.js";
Alternatively, if you are using the [Asynchronous Module Definition (AMD) API](https://github.com/amdjs/amdjs-api/blob/master/AMD.md), you can load the same function as follows:

```javascript
define(["jwt_decode"], (jwtDecode) => {
const token = "eyJhsw5c";
const decoded = jwtDecode(token);
});
</script>
```

## Feedback
Expand Down
1 change: 0 additions & 1 deletion lib/index.umd.ts

This file was deleted.

13 changes: 1 addition & 12 deletions rollup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,7 @@ const plugins = [

const input = "lib/index.ts";

export default defineConfig([{
input: "lib/index.umd.ts",
output: {
name: "jwt_decode",
file: "build/jwt-decode.js",
format: "umd",
sourcemap: true,
},
plugins: [
tsPlugin,
]
},
export default defineConfig([
{
input,
output: {
Expand Down

0 comments on commit 506ce6c

Please sign in to comment.