'How to use nodejs library date-holidays in browser

I want to use https://github.com/commenthol/date-holidays in a browser (front-end).

I have no idea how to achieve this. On that github under usage there is a script that I can use using node. But not in a browser because the require statement.

I tried things with browserify but it gives

ParseError: 'import' and 'export' may appear only with 'sourceType: module'

I googled and tried some options like -p esmify and some others but that errors remain.

I just want to have a js file I can use in a script tag in a browser. So that I can do things like

hd = new Holidays('NL')
var holidays = hd.getHolidays(2022, 'fr')

in the browser.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source