├── components/
│ ├── index.js
│ ├── c-big.js
│ └── c-small.js
├── pages/
│ └── index.js
├── reexport.js
└── reexport-ns.js
rm -rf .next/ && npm run build && ncdu .next/static/
Compare size of .next/static/
with different pages/index.js
import { CSmall } from "../components/c-small.js";
import { CBig } from "../components/c-big.js";
export default function Home() {
return (
<>
<CSmall />
<CBig />
</>
);
}
Output size: 1.5 MiB
import { CSmall } from "../components/c-small.js";
import { CBig } from "../components/c-big.js";
export default function Home() {
return <CSmall />;
}
Output size: 372.0 KiB - ✅ SHAKEN
import { CSmall, CBig } from "../components";
export default function Home() {
return <CSmall />;
}
Output size: 372.0 KiB - ✅ SHAKEN
import * as C from "../components";
export default function Home() {
return <C.CSmall />;
}
Output size: 372.0 KiB - ✅ SHAKEN
import * as C from "../reexport.js";
export default function Home() {
return <C.CSmall />;
}
Output size: 372.0 KiB - ✅ SHAKEN
import { C } from "../reexport-ns.js";
export default function Home() {
return <C.CSmall />;
}
Output size: 372.0 KiB - ✅ SHAKEN