size-limit icon indicating copy to clipboard operation
size-limit copied to clipboard

Can't ignore the entry file

Open jaydenseric opened this issue 5 years ago • 3 comments

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:

  • size-limit-entries
  • size-limit-entries/browser.mjs
  • ./size-limit-entries
  • ./size-limit-entries/browser.mjs

When using --why:

Screen Shot 2020-04-06 at 6 54 49 pm

jaydenseric avatar Apr 06 '20 08:04 jaydenseric

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

ai avatar Apr 06 '20 09:04 ai

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

jaydenseric avatar Apr 06 '20 09:04 jaydenseric

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.

ai avatar Apr 06 '20 09:04 ai