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
/*#__PURE__*/ markers are stripped out by Metro (in metro-transform-worker) and never reaches esbuild.
Metro hard-codes the option to strip out comments so there is currently no clean way to change this. Verified that replacing the three instances of comments: false with comments: true fixes the issue.
Summary:
Changelog:
* **[Feature]**: Preserve comments in unminified builds, while continuing to strip all comments from minified builds.
Add support for preserving comments in code. Useful for preserving `/*#__PURE__*/` annotations that aid tree shaking.
NOTE: In a future version of Metro, the default minifier options will change to align with the underlying minifier's default, e.g. `comments: 'some'` in Terser.
Pull Request resolved: #967
Test Plan:
Test case here: microsoft/rnx-kit#2365
| | Size |
| :----- | ------: |
| Before | 1567764 |
| After | 1258413 |
| Diff | -309351 |
Reviewed By: jacdebug
Differential Revision: D45223689
Pulled By: motiz88
fbshipit-source-id: 89c1e4050e67c3c34ec74015986827425b5fc76c
What happened?
/*#__PURE__*/
markers are stripped out by Metro (inmetro-transform-worker
) and never reaches esbuild.Metro hard-codes the option to strip out comments so there is currently no clean way to change this. Verified that replacing the three instances of
comments: false
withcomments: true
fixes the issue.Docs: https://babeljs.io/blog/2018/08/27/7.0.0#pure-annotation-support
Affected Package
@rnx-kit/metro-serializer-esbuild
Version
*
Which platforms are you seeing this issue on?
System Information
Steps to Reproduce
Add
react-native-icons
and bundle:Code of Conduct
The text was updated successfully, but these errors were encountered: