Packages: Add information for webpack about no side effects#17862
Packages: Add information for webpack about no side effects#17862
Conversation
packages/i18n/package.json
Outdated
| "main": "build/index.js", | ||
| "module": "build-module/index.js", | ||
| "react-native": "src/index", | ||
| "sideEffects": false, |
There was a problem hiding this comment.
I'm not sure this one is sideEffects free (it contain globals)
There was a problem hiding this comment.
Happy to remove it to move forward 👍
c006131 to
3fe42e7
Compare
* Packages: Add information for webpack about no side effects * Update README.md
|
@gziolo Any reason why |
|
It's a big package, I wanted to avoid taking a risk during the beta phase of WordPress 5.3 release, we should try to include it 👍 |
|
I`ve opened a PR doing that (#18911, tests still running), from smoke-testing locally there doesn’t seem to be any regressions. |
|
Hi @gzilo, does this change still needs a backport/change in WordPress core or the change was already shipped in WordPress 5.3/subsquent package updated? |
|
Yes, it was cherry-picked for WordPress 5.3 and now it's included in Gutenberg packages by default so no need to do anything 👍 |
Description
Previous work from @talldan: #14135 as explained in #13910:
In our case, this is extremely important for
@wordpress/block-librarypackage to ensure that dead code behind theGUTENBERG_PHASEflag isn't bundled in WordPress 5.3 release.I also included other packages which @talldan discovered as side-effects free. However, I took a more cautious approach and marked only those packages which only export their APIs which are pure.
Testing
Set
GUTENBRG_PHASEflag to 1:Make sure that everything works.
Validate that the block library module is 65kb smaller after running
npm run build.Before
After