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

chore: export default and named packages #2022

Merged
merged 3 commits into from
Jun 7, 2024

Conversation

SethFalco
Copy link
Member

@SethFalco SethFalco commented Jun 7, 2024

Makes three minor changes.

  1. Include VERSION in the type definition, this was missed before.
  2. Make it so SVGO exports both default and named exports. (For a consistent interface between require and import.)
  3. Change the version in package.json to 4.0.0-rc.0.

For more context on exports, this ensures a more consistent API between CJS and ESM, see the following:

// default.mjs
import SVGO from 'svgo'; // not possible before
console.log(SVGO.VERSION); // 4.0.0-rc.0

// destruct.mjs
import { VERSION } from 'svgo';
console.log(VERSION);  // 4.0.0-rc.0

// default.cjs
const SVGO = require('svgo');
console.log(SVGO.VERSION);  // 4.0.0-rc.0

// destruct.cjs
const { VERSION } = require('svgo');
console.log(VERSION); // 4.0.0-rc.0

// browser.mjs
import SVGO from 'svgo/browser';
console.log(SVGO.VERSION); // 4.0.0-rc.0

@SethFalco SethFalco merged commit 35d3fb6 into svg:main Jun 7, 2024
10 checks passed
@SethFalco SethFalco deleted the chores-default-export branch June 7, 2024 17:08
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

Successfully merging this pull request may close these issues.

1 participant