stwui icon indicating copy to clipboard operation
stwui copied to clipboard

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

Open darksimpson opened this issue 7 months ago • 0 comments

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 avatar Jul 02 '24 21:07 darksimpson