Cannot import rrule library: TypeError: Cannot read property 'HOURLY' of undefined
-
[X] Verify that you've looked through existing issues for duplicates before creating a new one
-
[x] Code sample reproducing the issue. Be sure to include all input values you are using such as the exact RRule string and dates.
import { RRule } from 'rrule'; console.log(RRule); -
[X] Expected output I should see a log with the RRule value
-
[X] Actual output

-
[X] The version of
rruleyou are using "rrule": "^2.6.6" -
[X] Your operating system MacOS
-
[X] Your local timezone Thu Oct 15 19:42:45 CDT 2020 (America/Monterrey)
Basically, I am trying to log the RRule class but i got the error above.
I've done some research on this, as I'm getting the same error. It's baffling to me that this would crash on load, so i suspect we're in the minority with this problem.
I get this problem using rollup-plugin-commonjs-alternate, but if I switch to @rollup/plugin-commonjs everything seems to work as expected. I see @blogui91 is using webpack, which might have the same problem, but I haven't seen any details on the build setup, and I'm less familiar with webpack, so I was unable to reproduce using it.
From the emitted code, it seems this is caused by the lazy, runtime import to avoid circular refs. For me, rollup-plugin-commonjs-alternate correctly identifies that nlp/index.js should be imported when encountering the runtime import, but @rollup/plugin-commonjs fails to handle the import at all, so rrule is missing the needed code (and so it does not produce the error).
Properly resolving the circular imports should solve this. I'll take a look at it.
This is likely fixed in the new version of rrule.