Skip to content

Commit

Permalink
Use a default export for UMD module
Browse files Browse the repository at this point in the history
  • Loading branch information
jonkoops committed Jul 31, 2023
1 parent 8e17e0f commit c2bac35
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
6 changes: 0 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,6 @@ Copy the file `jwt-decode.js` from the `build/` folder to your project somewhere
```html
<script src="jwt-decode.js"></script>
```
The jwtDecode function is exposed as a property on the global `jwt_decode` property:

```javascript
const token = "eyJhsw5c";
const decoded = jwt_decode.jwtDecode(token);
```

## Feedback

Expand Down
1 change: 1 addition & 0 deletions lib/index.umd.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { jwtDecode as default } from './index';
7 changes: 5 additions & 2 deletions rollup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,14 @@ const plugins = [
const input = "lib/index.ts";

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

0 comments on commit c2bac35

Please sign in to comment.