Skip to content

Commit

Permalink
Use unminified builds in npm exports
Browse files Browse the repository at this point in the history
This aids IDEs' go to definition feature. Also indicate unpkg links in the readme for browsers.
  • Loading branch information
jannikac authored Jun 17, 2024
1 parent 169df6a commit c68282f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ If you are working with a browser, be aware this is an ES6 module:

```html
<script type="module">
import ICAL from "https://unpkg.com/ical.js";
import ICAL from "https://unpkg.com/ical.js/dist/ical.min.js";
document.querySelector("button").addEventListener("click", () => {
ICAL.parse(document.getElementById("txt").value);
});
Expand All @@ -51,11 +51,17 @@ If you are working with a browser, be aware this is an ES6 module:

If you need to make use of a script tag, you can use the transpiled ES5 version:
```html
<script src="https://unpkg.com/ical.js/dist/ical.es5.cjs"></script>
<script src="https://unpkg.com/ical.js/dist/ical.es5.min.cjs"></script>
<textarea id="txt"></textarea>
<button onclick="ICAL.parse(document.getElementById('txt').value)"></button>
```

The browser examples above use the minified versions of the library, which is probably what you want.
However, there are also unminified versions of ICAL.js available on unpkg.

- Unminified ES6 module: `https://unpkg.com/ical.js/dist/ical.js`
- Unminified ES5 version: `https://unpkg.com/ical.js/dist/ical.es5.cjs`

## Timezones
The stock ical.js does not register any timezones, due to the additional size it brings. If you'd
like to do timezone conversion, and the timezone definitions are not included in the respective ics
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@
"ghpages": "npm run jsdoc && npm run validator && npm run recurtester"
},
"exports": {
"import": "./dist/ical.min.js",
"require": "./dist/ical.es5.min.cjs"
"import": "./dist/ical.js",
"require": "./dist/ical.es5.cjs"
},
"files": [
"dist/ical.js",
Expand Down

0 comments on commit c68282f

Please sign in to comment.