Skip to content
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

minification: assume pure getters #37054

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions build-system/babel-config/minified-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ function getMinifiedConfig() {
assumptions: {
constantSuper: true,
noClassCalls: true,
pureGetters: true,
setClassMethods: true,
},
};
Expand Down
1 change: 1 addition & 0 deletions build-system/tasks/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -570,6 +570,7 @@ async function minify(code, map) {
// Settled on this count by incrementing number until there was no more
// effect on minification quality.
passes: 3,
'pure_getters': true,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a bit safer, and will keep things known to throw an error.

Suggested change
'pure_getters': true,
'pure_getters': 'strict',

Copy link
Member Author

@samouri samouri Nov 24, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thats actually the default value.
Maybe this is also resolvable within terser, as I'd expect something like Object.prototype.hasOwnProperty to be "known" not to throw, whereas currently it isn't DCEd

},
output: {
beautify: !!argv.pretty_print,
Expand Down