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

Recommended way to limit total size of an ESM library #265

Open
silvenon opened this issue Oct 26, 2021 · 4 comments
Open

Recommended way to limit total size of an ESM library #265

silvenon opened this issue Oct 26, 2021 · 4 comments

Comments

@silvenon
Copy link

Hello! In my library I have a root ESM index file exporting everything, so I would like to use that to limit the total size of my library. Simply specifying the file with path doesn't appear to be enough, as the size ends up being zero or next to zero, so is there a way to import all exports somehow, for example import: "*"? What is generally the recommended way to limit total size in an ESM library?

@silvenon silvenon changed the title Recommended way to check total size of all exports in ESM Recommended way to limit total size of an ESM library Oct 26, 2021
@silvenon
Copy link
Author

silvenon commented Oct 26, 2021

One easy workaround I can think of is to create a measurer.js file:

import * as everything from './lib'

export { everything }

then in .size-limit.js:

{
  name: 'Total',
  path: `${__dirname}/measurer.js`,
  import: '{ everything }',
}

but I'm wondering if there's a more straightforward way.

@ai
Copy link
Owner

ai commented Oct 27, 2021

We had some discussion here #263

I small PR with extra syntax for import is needed indid. Do you want to help?

@silvenon
Copy link
Author

silvenon commented Oct 27, 2021

We had some discussion here #263

Could you explain how code coverage is related?

I small PR with extra syntax for import is needed indid. Do you want to help?

I do! What syntax do you want? I instinctively went for * when I was trying it out, so that might be good, do you have another idea?

@ai
Copy link
Owner

ai commented Oct 27, 2021

Could you explain how code coverage is related?

Oops. Wrong link.

Here is right one #261

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