Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop UMD bundle #193

Merged
merged 2 commits into from
Aug 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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