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

Including "Select" in tree-shaking manner breaks tree-shaking at all #220

Open
darksimpson opened this issue Jul 2, 2024 · 0 comments
Open
Labels
bug Something isn't working

Comments

@darksimpson
Copy link

darksimpson commented Jul 2, 2024

Current Behavior

When "Select" is included like told from docs to be tree-shaking aware:
import Select from 'stwui/select';
tree-shaking breaks and all complete STWUI library is included, according to output JS size and rollup-plugin-visualizer stats.

Expected Behavior

When "Select" is included like told from docs to be tree-shaking aware:
import Select from 'stwui/select';
tree-shaking must be performed well and only neccessary components shall be included, not all STWUI library code.

Steps To Reproduce

  1. Create any project from empty template, include "Select" this way:
  2. import Button from 'stwui/button';
  3. Build, check the size and dependencies using rollup-plugin-visualizer (only Button code and some helper code of couse will be included)
  4. import Select from 'stwui/select';
  5. Build, check the size and dependencies using rollup-plugin-visualizer (all STWUI code will be included, this is erroneous behavior)

Link to Reproduction / Stackblitz

No response

More Information

I've checked and found that problem resides in Select.svelte component code. At now, Icon is included like this:
import { Icon } from '../../'; (at line 5) and this includes complete STWUI in result
must be fixed to include it like this:
import Icon from '../icon';
I will prepare a pull request.

@darksimpson darksimpson added the bug Something isn't working label Jul 2, 2024
darksimpson added a commit to darksimpson/stwui that referenced this issue Jul 2, 2024
Fixed issue N00nDay#220: including "Select" in tree-shaking manner breaks tree-shaking at all
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant