chrono icon indicating copy to clipboard operation
chrono copied to clipboard

Include usage with <script> tag and CDN only

Open Prid13 opened this issue 3 years ago • 2 comments

Is there an officially supported way of just using this library as a single (minified) JS file that you can include via a <script> tag and immediately start using without dealing with NPM or ES6 modules?

I managed to get it working via the "hack" below, but I have no idea if the approach is encouraged or prone to errors?

Non-NPM / non-module usage:

  1. Include this script: https://www.unpkg.com/chrono-node/dist/bundle.js
  2. Use the global variable chrono in your script

E.g. chrono.parseDate('Tomorrow at 4 PM PST')

⚠ Note: I have not tested this extensively, so don't expect it to work flawlessly

Prid13 avatar Jun 28 '22 18:06 Prid13

ditto

arielaco avatar Aug 10 '23 18:08 arielaco

Hello. It would take time for me to setup ENV to fix the build configuration.

In the meantime, would include the script and use chrono in the top-level window works? https://www.unpkg.com/browse/[email protected]/dist/cjs/index.js

wanasit avatar Aug 20 '23 05:08 wanasit