-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Packages: Add information for webpack about no side effects #17862
Conversation
packages/i18n/package.json
Outdated
@@ -20,6 +20,7 @@ | |||
"main": "build/index.js", | |||
"module": "build-module/index.js", | |||
"react-native": "src/index", | |||
"sideEffects": false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure this one is sideEffects free (it contain globals)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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-library
package to ensure that dead code behind theGUTENBERG_PHASE
flag 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_PHASE
flag to 1:Make sure that everything works.
Validate that the block library module is 65kb smaller after running
npm run build
.Before
After