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

CommonJS support #4

Closed
CodyJasonBennett opened this issue Aug 21, 2021 · 3 comments
Closed

CommonJS support #4

CodyJasonBennett opened this issue Aug 21, 2021 · 3 comments
Assignees

Comments

@CodyJasonBennett
Copy link

Although Node has modules support, many modern build processes still rely on CJS exports.

Maybe support multiple environments with something like rollup:

// rollup.config.js
[
  {
    input: `./index.js`,
    output: { file: `dist/index.js`, format: 'esm' }
  },
  {
    input: `./index.js`,
    output: { file: `dist/index.cjs`, format: 'cjs' }
    ]
  }
]
// package.json
{
  "main": "dist/index.cjs",
  "module": "dist/index.js"
}
@CodyJasonBennett CodyJasonBennett changed the title CommonJS export CommonJS support Aug 21, 2021
@lifthrasiir lifthrasiir self-assigned this Aug 22, 2021
@lifthrasiir
Copy link
Owner

I've added support for CommonJS compatibility in 3407609. Could you please check if it works for your use case? Thank you!

@CodyJasonBennett
Copy link
Author

It does but why is the engine in package.json so high?

@lifthrasiir
Copy link
Owner

Because I haven't tested with other versions of Node.js. (14 in the README is my guess and might not work.) Fixing that is another job to do and I've got so many things to do first... Anyway I'm glad that it works!

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

No branches or pull requests

2 participants