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

Using --why --save-bundle <DIR> with multiple sections is buggy #377

Open
iMoses opened this issue Jan 6, 2025 · 1 comment
Open

Using --why --save-bundle <DIR> with multiple sections is buggy #377

iMoses opened this issue Jan 6, 2025 · 1 comment

Comments

@iMoses
Copy link

iMoses commented Jan 6, 2025

I tried using size-limit --why --clean-dir --save-bundle ./test with a config file that looks like this:

const defaultConfig = {
    path: './src/main-modules.ts',
    brotli: false,
};

module.exports = [
    {
        name: 'Full package',
        import: '*',
        limit: '200 kB',
        ...defaultConfig,
    },
    {
        name: 'Testing EventEmitter',
        import: '{ EventEmitter }',
        limit: '20 kB',
        ...defaultConfig,
    },
    {
        name: 'Testing Pool',
        import: '{ Pool }',
        limit: '20 kB',
        ...defaultConfig,
    },
];

While multiple .html report files are generated with different names, as the sections, the .js files generated are always with the same name. This results in only the last section actually being tested (I assume they override each other) and all the reports are taintent and identical. (based on the last section)
I didn't look into the library's code yet but I assume the solution should be to also generate multiple index.js files based on the section name.

P.S. It'd also be nice to be able to cancel minification from the config options. This helps a lot when trying to debug why tree-shaking is failing.

@ai
Copy link
Owner

ai commented Jan 6, 2025

Yes, it is known limit.

We can add warning to output. PR is welcome.

Also, if you have idea how to fix it, I am open for suggestions too.

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