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

Fixes #366: Add compatibility for using CommonJs #381

Closed
wants to merge 2 commits into from

Conversation

jheagle
Copy link

@jheagle jheagle commented Feb 15, 2024

Fixes #366

Add compatibility for using CommonJs since this package is intended for GulpJs which does yet support ES6,

  • Install common-exports to be able to convert the package to CommonJs.
  • Update the package to not be type=module.
  • Update the file extensions to .mjs (I also don't like this, but the alternative of .cjs was not compatible)
  • Add a gulpfile.js and babel.config.js to be able to run common-exports.
  • Create the CommonJs files in a new cjs directory.
  • Add a duplicate of the test.js file to be able to test the CommonJs compiled files.
  • Add signal-exit since the latest version is a dependency of mozjpeg to prevent failures with onExit missing.

…or GulpJs which does yet support ES6,

 - Install common-exports to be able to convert the package to CommonJs.
 - Update the package to not be type=module.
 - Update the file extensions to .mjs (I also don't like this, but the alternative of .cjs was not compatible)
 - Add a gulpfile.js and babel.config.js to be able to run common-exports.
 - Create the CommonJs files in a new cjs directory.
 - Add a duplicate of the test.js file to be able to test the CommonJs compiled files.
 - Add signal-exit since the latest version is a dependency of mozjpeg to prevent failures with onExit missing.
@jheagle jheagle marked this pull request as ready for review February 15, 2024 20:27
…re compiled files

 - There are three files (test.js, gulpfile.js and babel.config.js) which necessarily use require syntax. To remove these errors, I have reduced prefer-module level to warning.
@sindresorhus
Copy link
Owner

Thanks, but Gulp does support ESM.

Repository owner locked as resolved and limited conversation to collaborators May 5, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unable to import
2 participants