Skip to content

Conversation

@hyperz111
Copy link

Use semver per-method import for make the index.cjs size is smaller.

@hyperz111
Copy link
Author

Before

$ npm run build

> [email protected] build
> esbuild index.js --bundle --platform=node --outfile=index.cjs


  index.cjs  81.2kb

⚡ Done in 54ms

After

$ npm run build

> [email protected] build
> esbuild index.js --bundle --platform=node --outfile=index.cjs


  index.cjs  59.0kb

⚡ Done in 160ms

@hyperz111
Copy link
Author

@fisker

@hyperz111
Copy link
Author

@keithamus

Comment on lines +6 to +7
import semverCompare from 'semver/functions/compare.js'
import semverMinVersion from 'semver/ranges/min-version.js'
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use exports? e.g. import {compare, minVersion} or so?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use exports? e.g. import {compare, minVersion} or so?

We can, but...

$ npm run build

> [email protected] build
> esbuild index.js --bundle --platform=node --outfile=index.cjs


  index.cjs  81.2kb

⚡ Done in 124ms

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.

2 participants