size-limit: Error: “Size Limit can't resolve fs”

When attempting to run size-limit, I get this error:

 ERROR  Size Limit can't resolve
        in /Users/jaydenseric/Sites/apollo-upload-server/node_modules/busboy/lib

When using "webpack": false the error does not appear.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 20 (11 by maintainers)

Commits related to this issue

Most upvoted comments

We can do:

  1. npm pack
  2. unzip package to temporary dir
  3. npm install
  4. Check dir size

But we must to do it in separated project. Maybe package-limit?

@styfle I very like the project. It will be more accurate than Size Limit since it will calculate also non-jS files. Do you have CI tool to run it in Travis CI?

I have two news:

  1. Size Limit was not designed for this use cases.
  2. But I really like your idea. I will try to implement it. Unfortunately, it could take few weeks. I will add special option to ignore all Node.js modules and disable gzip and uglify.

Here is a temporary workaround:

  1. Add browser: { fs: false } to your package.json. It will say for webpack to ignore this module.
  2. Add gzip: false to Size Limit config since you are care about size on the disk.

Will like work for you until I will finding better solution?

I decided that at least for now, fs will not be part as default. It is much safer to explicitly define it in ignore or in browsers.

If we will have this issue again in the future, I can change my mind.

@styfle very nice service indeed! In fact I love it, awesome to see somebody made this. Sadly as you already mentioned it checks the size after it is published while I would like to check the size in PRs.

Also proposal here:

Regarding the CLI tools:

Another use-case is for CLI packages, I’m currently searching for a way to keep the size in check. I found the module cost-of-modules which does the job put returns the size of all modules instead of only the total size. I’ve opened an issue about it:

Interesting use case. So you want to use Size Limit to control how much file size your project will have in user’s node_modules?

Do you run Size Limit on server-side project?


Why do you care about size of server size project?

Because I am a responsible package author, and want to ensure my packages are lean and efficient. This is particularly important for consumers that use Webpack or Babel to process their server-side code; they don’t want huge bundles or compile times.