jkbrzt / rrule

JavaScript library for working with recurrence rules for calendar dates as defined in the iCalendar RFC and more.
https://jkbrzt.github.io/rrule
Other
3.29k stars 514 forks source link

npm build fail? Requires changes to `import` to fix. #505

Closed ogrotten closed 2 years ago

ogrotten commented 2 years ago

rrule 2.6.9 ("rrule": "^2.6.9", from package.json) SvelteKit ("@sveltejs/kit": "next",)

This failure occurs on both Github Actions as well as local Ubuntu 20.04 (Win 11 WSL2)

Local message:

> Using @sveltejs/adapter-static
file:///[..private path..]/.svelte-kit/output/server/chunks/SeriesForm-e75ff8dd.js:4
import { RRule } from "rrule";
         ^^^^^
SyntaxError: Named export 'RRule' not found. The requested module 'rrule' is a CommonJS module, which may not support all module.exports as named exports.

This is fixed by making the following change

original import

import { RRule, RRuleSet, rrulestr } from 'rrule'

working import

import pkg from 'rrule';
const { RRule } = pkg;

Was this expected? Did I miss a doc/announcement?

sunshineo commented 2 years ago

@ogrotten can you provide a repo showing the issue? I tried to reproduce it but cannot Here is the project I tried to reproduce with https://github.com/sunshineo/rrule-issue-505 I have the import here https://github.com/sunshineo/rrule-issue-505/blob/main/src/lib/form.ts#L2 It compiles fine for me locally and on Github https://github.com/sunshineo/rrule-issue-505/runs/6700930131?check_suite_focus=true image

davidgoli commented 2 years ago

Please update to 2.7.0 and let me know if you're still having problems.