Tree shaking: are unused functions included to a bundle?
up vote
2
down vote
favorite
Do modern bundlers like Webpack or Rollup shake out only unused modules or are they capable of removing unused functions (or variables, classes) inside a module as well?
// src.js
export function unused() {}
export function used() {}
// bundle.js
// function unused() {} // <-- will this be included?
function used() {}
Searched on the subject but found nothing.
P.S. I've no experience with bundlers (other than zero-config Parcel) but I make the library that requires the answer to this question.
javascript webpack rollupjs parceljs tree-shaking
add a comment |
up vote
2
down vote
favorite
Do modern bundlers like Webpack or Rollup shake out only unused modules or are they capable of removing unused functions (or variables, classes) inside a module as well?
// src.js
export function unused() {}
export function used() {}
// bundle.js
// function unused() {} // <-- will this be included?
function used() {}
Searched on the subject but found nothing.
P.S. I've no experience with bundlers (other than zero-config Parcel) but I make the library that requires the answer to this question.
javascript webpack rollupjs parceljs tree-shaking
add a comment |
up vote
2
down vote
favorite
up vote
2
down vote
favorite
Do modern bundlers like Webpack or Rollup shake out only unused modules or are they capable of removing unused functions (or variables, classes) inside a module as well?
// src.js
export function unused() {}
export function used() {}
// bundle.js
// function unused() {} // <-- will this be included?
function used() {}
Searched on the subject but found nothing.
P.S. I've no experience with bundlers (other than zero-config Parcel) but I make the library that requires the answer to this question.
javascript webpack rollupjs parceljs tree-shaking
Do modern bundlers like Webpack or Rollup shake out only unused modules or are they capable of removing unused functions (or variables, classes) inside a module as well?
// src.js
export function unused() {}
export function used() {}
// bundle.js
// function unused() {} // <-- will this be included?
function used() {}
Searched on the subject but found nothing.
P.S. I've no experience with bundlers (other than zero-config Parcel) but I make the library that requires the answer to this question.
javascript webpack rollupjs parceljs tree-shaking
javascript webpack rollupjs parceljs tree-shaking
edited yesterday
James A Mohler
6,994123252
6,994123252
asked Nov 8 at 0:14
Nurbol Alpysbayev
2,1801220
2,1801220
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
1
down vote
accepted
Turns out I've searched not well enough.
Here: https://medium.com/@netxm/what-is-tree-shaking-de7c6be5cadd
the author says that unused functions won't be included.
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
accepted
Turns out I've searched not well enough.
Here: https://medium.com/@netxm/what-is-tree-shaking-de7c6be5cadd
the author says that unused functions won't be included.
add a comment |
up vote
1
down vote
accepted
Turns out I've searched not well enough.
Here: https://medium.com/@netxm/what-is-tree-shaking-de7c6be5cadd
the author says that unused functions won't be included.
add a comment |
up vote
1
down vote
accepted
up vote
1
down vote
accepted
Turns out I've searched not well enough.
Here: https://medium.com/@netxm/what-is-tree-shaking-de7c6be5cadd
the author says that unused functions won't be included.
Turns out I've searched not well enough.
Here: https://medium.com/@netxm/what-is-tree-shaking-de7c6be5cadd
the author says that unused functions won't be included.
answered Nov 8 at 0:25
Nurbol Alpysbayev
2,1801220
2,1801220
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53199814%2ftree-shaking-are-unused-functions-included-to-a-bundle%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown