You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to set up some (integration - I guess) tests to test my routing library's "tree-shakability" (it is @wjfe/n-savant, if you're curious). My plan is as follows:
Create base project with only package.json.
Install dev dependencies: rollup, rolldown, rollup-plugin-svelte, plus any other packages to also test bundling with webpack, RsPack, etc.
Create configuration files for each of the bundlers.
Prepare test cases: One index.js file per test case, where I individually import and use each one of the exports of the library.
Create the special test cases base and full, where the former is an index.js with just a console.log() line, and the latter imports and uses every object from the routing library.
Run the test matrix (probably in GH Actions).
Collect file manifest and total bundle sizes.
At least for now, no pass/fail criteria. Just collect data in a nice table and commit a Markdown file.
This sounds like a solid plan to me but do tell me if I'm wrong/delusional. 😄
Anyway, I'm testing the project out with rolldown, and to my surprise the base test case creates a bundled index.js of almost 93kb. Examining the bundled file, it is almost all Svelte code.
Since I'm a noob at tree-shaking and rolldown, my question is: Why does this happen? Or is it even normal for this to happen?
In contrast, bundling the same project with rollup, the bundled JS file only carries the following before the code from my index.js file:
// generated during release, do not modifyconstPUBLIC_VERSION='5';if(typeofwindow!=='undefined'){// @ts-expect-error((window.__svelte??={}).v??=newSet()).add(PUBLIC_VERSION);}
Could it be that I'm making a mistake in my rolldown config? Here it is:
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Hello, everyone!
I'm trying to set up some (integration - I guess) tests to test my routing library's "tree-shakability" (it is @wjfe/n-savant, if you're curious). My plan is as follows:
package.json
.rollup
,rolldown
,rollup-plugin-svelte
, plus any other packages to also test bundling with webpack, RsPack, etc.index.js
file per test case, where I individually import and use each one of the exports of the library.base
andfull
, where the former is anindex.js
with just aconsole.log()
line, and the latter imports and uses every object from the routing library.This sounds like a solid plan to me but do tell me if I'm wrong/delusional. 😄
Anyway, I'm testing the project out with
rolldown
, and to my surprise the base test case creates a bundledindex.js
of almost 93kb. Examining the bundled file, it is almost all Svelte code.Since I'm a noob at tree-shaking and
rolldown
, my question is: Why does this happen? Or is it even normal for this to happen?In contrast, bundling the same project with
rollup
, the bundled JS file only carries the following before the code from myindex.js
file:Could it be that I'm making a mistake in my
rolldown
config? Here it is:Beta Was this translation helpful? Give feedback.
All reactions