ai / size-limit

Calculate the real cost to run your JS app or lib to keep good performance. Show error in pull request if the cost exceeds the limit.
MIT License
6.55k stars 1.82k forks source link

Can't ignore the entry file #174

Open jaydenseric opened 4 years ago

jaydenseric commented 4 years ago

I have multiple size-limit entry files for server, browser, etc, like this:

[
  {
    "name": "Server",
    "path": "size-limit-entries/server.mjs",
    "limit": "2.6 KB",
    "ignore": ["./size-limit-entries/server.mjs", "prop-types"]
  },
  {
    "name": "Browser",
    "path": "size-limit-entries/browser.mjs",
    "limit": "2.6 KB",
    "ignore": ["./size-limit-entries/browser.mjs", "prop-types"]
  }
]

I don't want to include the entry files in the bundle size, as they only serve as a means to cherry pick relevant parts of the API for each size limit test and are not actually published.

For some reason none of these variations in the ignore array work:

When using --why:

Screen Shot 2020-04-06 at 6 54 49 pm
ai commented 4 years ago

Can you show the size before and after adding ignore? Do we have the problem with Webpack or only with --why?

jaydenseric commented 4 years ago

There is no change for either the reported sizes, or for the --why report.

Before:

Screen Shot 2020-04-06 at 7 25 13 pm

After:

Screen Shot 2020-04-06 at 7 25 17 pm
ai commented 4 years ago

Unfortunately, I will have a very rough week because of moving to another project.

Can you help me with the investigation?

Here is how we ignore nodules: https://github.com/ai/size-limit/blob/master/packages/webpack/get-config.js#L80-L90

We use webpack’s externals option and I am not sure that we use it right for your case. If you will do some hacks in your project (just open this file in node_modules) it will speed up the issue.