Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't use rrule with Node v14 since it is considered a CommonJS module #419

Closed
aioobe opened this issue Sep 13, 2020 · 2 comments · Fixed by #507
Closed

Can't use rrule with Node v14 since it is considered a CommonJS module #419

aioobe opened this issue Sep 13, 2020 · 2 comments · Fixed by #507

Comments

@aioobe
Copy link

aioobe commented Sep 13, 2020

Running into the following when trying to use rrule with Node 14:

import { RRule } from 'rrule';
         ^^^^^
SyntaxError: The requested module 'rrule' is expected to be of type CommonJS, which does not support named exports. CommonJS modules can be imported by importing the default export.
For example:
import pkg from 'rrule';
const { RRule } = pkg;
    at ModuleJob._instantiate (internal/modules/esm/module_job.js:98:21)
    at async ModuleJob.run (internal/modules/esm/module_job.js:137:5)
    at async Loader.import (internal/modules/esm/loader.js:165:24)
    at async Object.loadESM (internal/process/esm_loader.js:68:5)

See this Stack Overflow post for details.

I think this is the same issue as reported for lodash had here: lodash/lodash#4800 which was resolved in this PR: lodash/lodash#4826

rrule version: 2.6.6

OS: Ubuntu

@AllanDaemon
Copy link

I'm having the same issue too.

rrule version 2.6.8.

Node 16 is already released and a lot of projects are migrating from 12 to 14, so this seems to be an critical issue.

@karlhorky
Copy link

karlhorky commented Aug 13, 2021

This does seem to work when using the following syntax from the error message:

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

But it would be nice to get a solution that would allow for named imports.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants