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

[core] Minify error messages in production #21214

Merged
merged 29 commits into from
Jun 3, 2020

Conversation

eps1lon
Copy link
Member

@eps1lon eps1lon commented May 26, 2020

Based on how react minifies errors.

We currently only wrap console.(error|warn) in process.env.NODE_ENV !== "production" to strip these oftentimes large or expensive messages for production builds.

We don't do this for thrown errors since these affect strack traces and would make debugging very hard at the cost of not having code that is never used for working apps.

Using babel-plugin-macros they end up as throw new Error(a(1)) in production builds. This has a constant bundle size cost since a (minified from formatMuiErrorMessage). Logs a message explaining these codes.

For authors

If you think an error should be minified you have to throw new MuiError (from @material-ui/utils/macros/MuiError.macro) instead:

import MuiError from '@material-ui/utils/macros/MuiError.macro';

throw new MuiError('My message');

The messsage can only be a basic string literal e.g. 'a basic string literal' or multiple string literals concatenated with + e.g. 'A basic string literal.\n' 'With a newline concatenated.'. This ensures we can extract the error messages.

placeholders i.e. string interpolation

If you want to print variables in your error messages you have to use printf syntax similar to node's console.log:

throw new MuiError('Expected 1-10 but got %s', inputNumber)

inputNumber will end up in the url to the error decoder page so make sure the value has a useful serialization e.g. element?.tagName.

implementation

babel plugin

Input:

import MuiError from '@material-ui/utils/macros/MuiError.macro';

throw new MuiError('Material-UI: Expected valid input target.\n' + 'Did you use `inputComponent`.');

Output:

import { formatMuiErrorMessage as _formatMuiErrorMessage } from '@material-ui/utils';
throw new Error(
  process.env.NODE_ENV !== 'production'
    ? `Material-UI: Expected valid input target.
Did you use \\`inputComponent\\``
    : _formatMuiErrorMessage(1),
);

messages in production

To aid debugging in prod we collect a list of error codes that can be decoded on a dedicated page: /error-decoder?code=[code].

Current messages:

choices

  1. babel-plugin-macros
    This makes the transformation explicit. Otherwise we need to check our context since we don't always want to transform them (e.g. errors in custom propTypes). It also ensures that the dependency on @material-ui/utils is explicit. If this dependency isn't declared formatMuiErrorMessage wouldn't be available.

  2. error extraction during build time
    The original plan was to have a separate script for error code extraction but the order in which babel plugins are applied is important and somewhat brittle. By doing transformation and extraction in a single step we won't ever have problems.

This also ensures that we don't have to keep track of the list of transpiled files.

  1. Limiting to string literals and + concatenation
    We need a string that we can JSON.stringify into a .json file. So whatever we encounter in throw new Error(message) must be evaluated at build time. Array.prototype.join or template literals make this not trivial. As long as there's no fundamental behavior we're missing with the current syntax limitation I'd rather not spend much time on it. Allowing more syntax would require more code. And the more code the more likely bugs are.

  2. more to follow
    I probably already forgot some decisions. This is why I opened this before it's ready so that I'm forced to explain while implementing.

@github-actions github-actions bot added the PR: out-of-date The pull request has merge conflicts and can't be merged label May 26, 2020
Copy link
Member

@oliviertassinari oliviertassinari left a comment

Choose a reason for hiding this comment

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

Pretty cool!

return response.json();
})
.then((json) => {
if (cancelled === false) {
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

If this would be supported it's definitely a possibility for reducing wasteful fetches. I haven't looked at it because this approach works just as well? Is there some edge case I'm missing?

docs/src/pages.js Outdated Show resolved Hide resolved
@dmtrKovalenko
Copy link
Member

dmtrKovalenko commented May 26, 2020

Love this approach 😍

Will it work for errors throwed outside of core? I am wondering because there are couple of errors that would be useful to minify in production.

Maybe we can make some kind of namespace in the error-codes.json file? I think both pickers and datagrid will benefit from the unified error system.

@eps1lon
Copy link
Member Author

eps1lon commented May 27, 2020

Will it work for errors throwed outside of core? I am wondering because there are couple of errors that would be useful to minify in production.

Technically all we need to do is publish @material-ui/utils/macros/MuiError.macro and maybe make formatProdError configurable.

The "error-decoder" part is optional i.e. can be solved however you see fit. You could just throw an error code but that doesn't help users much and you'll have to deal with the error reports later.

@mui-pr-bot
Copy link

mui-pr-bot commented May 28, 2020

@material-ui/core: parsed: -0.18% 😍, gzip: -0.40% 😍
@material-ui/lab: parsed: -0.15% 😍, gzip: -0.27% 😍
@material-ui/utils: parsed: +5.26% , gzip: +6.45%

Details of bundle changes.

Comparing: 1596790...f3058db

Details of page changes
bundle Size Change Size Gzip Change Gzip
/production-error ▲ +2.87 kB (+Infinity% ) 2.87 kB ▼ -1 B (-Infinity% ) -1 B
docs:chunk:shared ▼ -160 B (-0.24% ) 65.8 kB -- -1 B
/_app ▲ +100 B (+0.27% ) 37.4 kB -- -1 B
/components/chips ▲ +100 B (+0.46% ) 22 kB -- -1 B
/components/hidden ▲ +100 B (+0.95% ) 10.6 kB -- -1 B
/performance/table-mui ▲ +20 B (+0.45% ) 4.5 kB -- -1 B
/blog/material-ui-v1-is-out ▼ -10 B (-0.15% ) 6.66 kB -- -1 B
/components/transfer-list ▲ +10 B (+0.10% ) 9.68 kB -- -1 B
/customization/density ▲ +10 B (+0.10% ) 9.73 kB -- -1 B
/discover-more/team ▲ +10 B (+0.15% ) 6.84 kB -- -1 B
/getting-started/templates/blog ▲ +10 B (+0.13% ) 7.45 kB -- -1 B
/getting-started/templates/pricing ▲ +10 B (+0.13% ) 7.79 kB -- -1 B
/getting-started/templates/sign-in ▲ +10 B (+0.12% ) 8.42 kB -- -1 B
/getting-started/templates/sign-up ▲ +10 B (+0.12% ) 8.52 kB -- -1 B
/system/shadows ▲ +10 B (+0.26% ) 3.86 kB -- -1 B
/api-docs/alert-title -- 1.4 kB -- -1 B
/api-docs/alert -- 2.4 kB -- -1 B
/api-docs/app-bar -- 1.94 kB -- -1 B
/api-docs/autocomplete -- 4.61 kB -- -1 B
/api-docs/avatar-group -- 1.51 kB -- -1 B
/api-docs/avatar -- 1.86 kB -- -1 B
/api-docs/backdrop -- 1.72 kB -- -1 B
/api-docs/badge -- 2.13 kB -- -1 B
/api-docs/bottom-navigation-action -- 1.81 kB -- -1 B
/api-docs/bottom-navigation -- 1.7 kB -- -1 B
/api-docs/breadcrumbs -- 1.79 kB -- -1 B
/api-docs/button-base -- 2.22 kB -- -1 B
/api-docs/button-group -- 2.22 kB -- -1 B
/api-docs/button -- 2.53 kB -- -1 B
/api-docs/card-action-area -- 1.58 kB -- -1 B
/api-docs/card-actions -- 1.47 kB -- -1 B
/api-docs/card-content -- 1.45 kB -- -1 B
/api-docs/card-header -- 1.78 kB -- -1 B
/api-docs/card-media -- 1.69 kB -- -1 B
/api-docs/card -- 1.5 kB -- -1 B
/api-docs/checkbox -- 2.3 kB -- -1 B
/api-docs/chip -- 2.46 kB -- -1 B
/api-docs/circular-progress -- 2.07 kB -- -1 B
/api-docs/click-away-listener -- 1.44 kB -- -1 B
/api-docs/collapse -- 2.13 kB -- -1 B
/api-docs/container -- 1.86 kB -- -1 B
/api-docs/css-baseline -- 1.4 kB -- -1 B
/api-docs/dialog-actions -- 1.47 kB -- -1 B
/api-docs/dialog-content-text -- 1.48 kB -- -1 B
/api-docs/dialog-content -- 1.45 kB -- -1 B
/api-docs/dialog-title -- 1.49 kB -- -1 B
/api-docs/dialog -- 2.73 kB -- -1 B
/api-docs/divider -- 1.81 kB -- -1 B
/api-docs/drawer -- 2.13 kB -- -1 B
/api-docs/expansion-panel-actions -- 1.49 kB -- -1 B
/api-docs/expansion-panel-details -- 1.41 kB -- -1 B
/api-docs/expansion-panel-summary -- 1.72 kB -- -1 B
/api-docs/expansion-panel -- 1.97 kB -- -1 B
/api-docs/fab -- 2.09 kB -- -1 B
/api-docs/fade -- 1.5 kB -- -1 B
/api-docs/filled-input -- 2.87 kB -- -1 B
/api-docs/form-control-label -- 1.98 kB -- -1 B
/api-docs/form-control -- 2.36 kB -- -1 B
/api-docs/form-group -- 1.55 kB -- -1 B
/api-docs/form-helper-text -- 1.91 kB -- -1 B
/api-docs/form-label -- 1.84 kB -- -1 B
/api-docs/grid-list-tile-bar -- 1.8 kB -- -1 B
/api-docs/grid-list-tile -- 1.72 kB -- -1 B
/api-docs/grid-list -- 1.62 kB -- -1 B
/api-docs/grid -- 2.56 kB -- -1 B
/api-docs/grow -- 1.55 kB -- -1 B
/api-docs/hidden -- 1.53 kB -- -1 B
/api-docs/icon-button -- 2.08 kB -- -1 B
/api-docs/icon -- 1.78 kB -- -1 B
/api-docs/input-adornment -- 1.93 kB -- -1 B
/api-docs/input-base -- 2.95 kB -- -1 B
/api-docs/input-label -- 2.07 kB -- -1 B
/api-docs/input -- 2.83 kB -- -1 B
/api-docs/linear-progress -- 2.03 kB -- -1 B
/api-docs/link -- 1.93 kB -- -1 B
/api-docs/list-item-avatar -- 1.5 kB -- -1 B
/api-docs/list-item-icon -- 1.51 kB -- -1 B
/api-docs/list-item-secondary-action -- 1.47 kB -- -1 B
/api-docs/list-item-text -- 1.79 kB -- -1 B
/api-docs/list-item -- 2.25 kB -- -1 B
/api-docs/list-subheader -- 1.77 kB -- -1 B
/api-docs/list -- 1.68 kB -- -1 B
/api-docs/menu-item -- 1.74 kB -- -1 B
/api-docs/menu-list -- 1.57 kB -- -1 B
/api-docs/menu -- 2.4 kB -- -1 B
/api-docs/mobile-stepper -- 1.93 kB -- -1 B
/api-docs/modal -- 2.42 kB -- -1 B
/api-docs/native-select -- 2.11 kB -- -1 B
/api-docs/no-ssr -- 1.3 kB -- -1 B
/api-docs/outlined-input -- 2.98 kB -- -1 B
/api-docs/pagination-item -- 1.97 kB -- -1 B
/api-docs/pagination -- 2.24 kB -- -1 B
/api-docs/paper -- 1.87 kB -- -1 B
/api-docs/popover -- 2.69 kB -- -1 B
/api-docs/popper -- 1.91 kB -- -1 B
/api-docs/portal -- 1.34 kB -- -1 B
/api-docs/radio-group -- 1.45 kB -- -1 B
/api-docs/radio -- 2.12 kB -- -1 B
/api-docs/rating -- 2.49 kB -- -1 B
/api-docs/root-ref -- 1.41 kB -- -1 B
/api-docs/scoped-css-baseline -- 1.4 kB -- -1 B
/api-docs/select -- 2.96 kB -- -1 B
/api-docs/skeleton -- 1.87 kB -- -1 B
/api-docs/slide -- 1.54 kB -- -1 B
/api-docs/slider -- 3.11 kB -- -1 B
/api-docs/snackbar-content -- 1.61 kB -- -1 B
/api-docs/snackbar -- 2.71 kB -- -1 B
/api-docs/speed-dial-action -- 2.04 kB -- -1 B
/api-docs/speed-dial-icon -- 1.55 kB -- -1 B
/api-docs/speed-dial -- 2.3 kB -- -1 B
/api-docs/step-button -- 1.63 kB -- -1 B
/api-docs/step-connector -- 1.54 kB -- -1 B
/api-docs/step-content -- 1.72 kB -- -1 B
/api-docs/step-icon -- 1.57 kB -- -1 B
/api-docs/step-label -- 1.9 kB -- -1 B
/api-docs/step -- 1.64 kB -- -1 B
/api-docs/stepper -- 1.84 kB -- -1 B
/api-docs/svg-icon -- 2.26 kB -- -1 B
/api-docs/swipeable-drawer -- 2 kB -- -1 B
/api-docs/switch -- 2.46 kB -- -1 B
/api-docs/tab-context -- 1.05 kB -- -1 B
/api-docs/tab-list -- 1.08 kB -- -1 B
/api-docs/tab-panel -- 1.45 kB -- -1 B
/api-docs/tab-scroll-button -- 1.61 kB -- -1 B
/api-docs/tab -- 1.97 kB -- -1 B
/api-docs/table-body -- 1.47 kB -- -1 B
/api-docs/table-cell -- 2.13 kB -- -1 B
/api-docs/table-container -- 1.48 kB -- -1 B
/api-docs/table-footer -- 1.47 kB -- -1 B
/api-docs/table-head -- 1.46 kB -- -1 B
/api-docs/table-pagination -- 2.46 kB -- -1 B
/api-docs/table-row -- 1.69 kB -- -1 B
/api-docs/table-sort-label -- 1.83 kB -- -1 B
/api-docs/table -- 1.68 kB -- -1 B
/api-docs/tabs -- 2.68 kB -- -1 B
/api-docs/text-field -- 3.18 kB -- -1 B
/api-docs/textarea-autosize -- 1.13 kB -- -1 B
/api-docs/toggle-button-group -- 1.92 kB -- -1 B
/api-docs/toggle-button -- 1.78 kB -- -1 B
/api-docs/toolbar -- 1.65 kB -- -1 B
/api-docs/tooltip -- 2.56 kB -- -1 B
/api-docs/tree-item -- 1.88 kB -- -1 B
/api-docs/tree-view -- 1.92 kB -- -1 B
/api-docs/typography -- 2.59 kB -- -1 B
/api-docs/unstable-trap-focus -- 1.44 kB -- -1 B
/api-docs/zoom -- 1.52 kB -- -1 B
/blog/2019-developer-survey-results -- 6.35 kB -- -1 B
/blog/2019 -- 4.24 kB -- -1 B
/blog/2020-introducing-sketch -- 3.51 kB -- -1 B
/blog/2020-q1-update -- 4.33 kB -- -1 B
/blog/april-2019-update -- 3.13 kB -- -1 B
/blog/august-2019-update -- 2.24 kB -- -1 B
/blog/december-2019-update -- 2.37 kB -- -1 B
/blog/july-2019-update -- 2.13 kB -- -1 B
/blog/june-2019-update -- 2 kB -- -1 B
/blog/march-2019-update -- 2.53 kB -- -1 B
/blog/material-ui-v4-is-out -- 9.68 kB -- -1 B
/blog/may-2019-update -- 2.35 kB -- -1 B
/blog/november-2019-update -- 2.75 kB -- -1 B
/blog/october-2019-update -- 2.5 kB -- -1 B
/blog/september-2019-update -- 2.68 kB -- -1 B
/company/about -- 1.74 kB -- -1 B
/company/contact -- 1.33 kB -- -1 B
/company/jobs -- 1.34 kB -- -1 B
/components/about-the-lab -- 6.8 kB -- -1 B
/components/alert -- 12.9 kB -- -1 B
/components/app-bar -- 30.2 kB -- -1 B
/components/autocomplete -- 110 kB -- -1 B
/components/avatars -- 9.2 kB -- -1 B
/components/backdrop -- 2.68 kB -- -1 B
/components/badges -- 15.4 kB -- -1 B
/components/bottom-navigation -- 6.25 kB -- -1 B
/components/box -- 8.05 kB -- -1 B
/components/breadcrumbs -- 14.7 kB -- -1 B
/components/button-group -- 7.61 kB -- -1 B
/components/buttons -- 26.4 kB -- -1 B
/components/cards -- 17.2 kB -- -1 B
/components/checkboxes -- 16.5 kB -- -1 B
/components/click-away-listener -- 4.94 kB -- -1 B
/components/container -- 3.78 kB -- -1 B
/components/css-baseline -- 7.05 kB -- -1 B
/components/dialogs -- 43.1 kB -- -1 B
/components/dividers -- 12.8 kB -- -1 B
/components/drawers -- 31.5 kB -- -1 B
/components/expansion-panels -- 20.7 kB -- -1 B
/components/floating-action-button -- 10.9 kB -- -1 B
/components/grid-list -- 12 kB -- -1 B
/components/grid -- 32.4 kB -- -1 B
/components/icons -- 27.6 kB -- -1 B
/components/links -- 7.04 kB -- -1 B
/components/lists -- 26.5 kB -- -1 B
/components/material-icons -- 729 kB -- -1 B
/components/menus -- 25.2 kB -- -1 B
/components/modal -- 12.9 kB -- -1 B
/components/no-ssr -- 5.33 kB -- -1 B
/components/pagination -- 8.19 kB -- -1 B
/components/paper -- 3.49 kB -- -1 B
/components/pickers -- 39.3 kB -- -1 B
/components/popover -- 17.6 kB -- -1 B
/components/popper -- 22.5 kB -- -1 B
/components/portal -- 3.17 kB -- -1 B
/components/progress -- 21.2 kB -- -1 B
/components/radio-buttons -- 15.6 kB -- -1 B
/components/rating -- 11 kB -- -1 B
/components/selects -- 33.1 kB -- -1 B
/components/skeleton -- 13.2 kB -- -1 B
/components/slider -- 16.3 kB -- -1 B
/components/snackbars -- 22.4 kB -- -1 B
/components/speed-dial -- 14.6 kB -- -1 B
/components/steppers -- 36.9 kB -- -1 B
/components/switches -- 16.9 kB -- -1 B
/components/tables -- 174 kB -- -1 B
/components/tabs -- 24.4 kB -- -1 B
/components/text-fields -- 56.6 kB -- -1 B
/components/textarea-autosize -- 3.04 kB -- -1 B
/components/toggle-button -- 11.9 kB -- -1 B
/components/tooltips -- 17.5 kB -- -1 B
/components/transitions -- 12.6 kB -- -1 B
/components/tree-view -- 11.3 kB -- -1 B
/components/typography -- 9.96 kB -- -1 B
/components/use-media-query -- 12.9 kB -- -1 B
/customization/breakpoints -- 16.3 kB -- -1 B
/customization/color -- 20.9 kB -- -1 B
/customization/components -- 38.6 kB -- -1 B
/customization/default-theme -- 8.92 kB -- -1 B
/customization/globals -- 5.23 kB -- -1 B
/customization/palette -- 14.1 kB -- -1 B
/customization/spacing -- 2.82 kB -- -1 B
/customization/theming -- 18.3 kB -- -1 B
/customization/typography -- 12.5 kB -- -1 B
/customization/z-index -- 3.47 kB -- -1 B
/discover-more/backers -- 3.03 kB -- -1 B
/discover-more/changelog -- 1.45 kB -- -1 B
/discover-more/languages -- 3.44 kB -- -1 B
/discover-more/related-projects -- 7.56 kB -- -1 B
/discover-more/roadmap -- 3.72 kB -- -1 B
/discover-more/showcase -- 15.1 kB -- -1 B
/discover-more/vision -- 6.76 kB -- -1 B
/getting-started/example-projects -- 7.57 kB -- -1 B
/getting-started/faq -- 34.6 kB -- -1 B
/getting-started/installation -- 7.85 kB -- -1 B
/getting-started/learn -- 8.98 kB -- -1 B
/getting-started/support -- 9.15 kB -- -1 B
/getting-started/supported-components -- 6.74 kB -- -1 B
/getting-started/supported-platforms -- 6.1 kB -- -1 B
/getting-started/templates -- 8.92 kB -- -1 B
/getting-started/templates/album -- 5.57 kB -- -1 B
/getting-started/templates/checkout -- 10.2 kB -- -1 B
/getting-started/templates/dashboard -- 8.86 kB -- -1 B
/getting-started/templates/sign-in-side -- 8.18 kB -- -1 B
/getting-started/templates/sticky-footer -- 1.54 kB -- -1 B
/getting-started/usage -- 9.6 kB -- -1 B
/guides/api -- 14.4 kB -- -1 B
/guides/composition -- 14.9 kB -- -1 B
/guides/flow -- 2.26 kB -- -1 B
/guides/interoperability -- 15.9 kB -- -1 B
/guides/localization -- 18.8 kB -- -1 B
/guides/migration-v0x -- 7.39 kB -- -1 B
/guides/migration-v3 -- 19.2 kB -- -1 B
/guides/minimizing-bundle-size -- 10 kB -- -1 B
/guides/responsive-ui -- 4.27 kB -- -1 B
/guides/right-to-left -- 5.24 kB -- -1 B
/guides/server-rendering -- 8.75 kB -- -1 B
/guides/testing -- 8.7 kB -- -1 B
/guides/typescript -- 15.1 kB -- -1 B
/performance/table-component -- 1.44 kB -- -1 B
/performance/table-emotion -- 8.5 kB -- -1 B
/performance/table-hook -- 2.24 kB -- -1 B
/performance/table-raw -- 612 B -- -1 B
/performance/table-styled-components -- 2.6 kB -- -1 B
/premium-themes/onepirate -- 7.34 kB -- -1 B
/premium-themes/onepirate/forgot-password -- 1.01 kB -- -1 B
/premium-themes/onepirate/privacy -- 4.44 kB -- -1 B
/premium-themes/onepirate/sign-in -- 1.07 kB -- -1 B
/premium-themes/onepirate/sign-up -- 1.12 kB -- -1 B
/premium-themes/onepirate/terms -- 11.8 kB -- -1 B
/premium-themes/paperbase -- 7.67 kB -- -1 B
/styles/advanced -- 31.7 kB -- -1 B
/styles/api -- 16.9 kB -- -1 B
/styles/basics -- 16.5 kB -- -1 B
/system/api -- 5.96 kB -- -1 B
/system/basics -- 27.6 kB -- -1 B
/system/borders -- 4.1 kB -- -1 B
/system/display -- 6.55 kB -- -1 B
/system/flexbox -- 5.85 kB -- -1 B
/system/palette -- 4.35 kB -- -1 B
/system/positions -- 2.53 kB -- -1 B
/system/sizing -- 3.53 kB -- -1 B
/system/spacing -- 6.01 kB -- -1 B
/system/typography -- 4.42 kB -- -1 B
/versions -- 23 kB -- -1 B
docs:shared:chunk/commons -- 5.99 kB -- -1 B
docs:shared:chunk/framework -- 42.3 kB -- -1 B
docs:shared:runtime/main -- 6.78 kB -- -1 B
docs:shared:runtime/webpack -- 1.24 kB -- -1 B
bundle Size Change Size Gzip Change Gzip
packages/material-ui/material-ui.production.min.js ▼ -729 B (-0.22% ) 326 kB ▼ -360 B (-0.38% ) 94.7 kB
@material-ui/core ▼ -651 B (-0.18% ) 371 kB ▼ -413 B (-0.40% ) 102 kB
Select ▼ -556 B (-0.45% ) 122 kB ▼ -301 B (-0.83% ) 36.1 kB
TextField ▼ -555 B (-0.42% ) 131 kB ▼ -312 B (-0.81% ) 38.3 kB
TablePagination ▼ -554 B (-0.37% ) 149 kB ▼ -314 B (-0.71% ) 43.6 kB
Input ▼ -483 B (-0.62% ) 77.1 kB ▼ -265 B (-1.09% ) 24 kB
FilledInput ▼ -483 B (-0.61% ) 78.2 kB ▼ -264 B (-1.08% ) 24.2 kB
OutlinedInput ▼ -483 B (-0.61% ) 79.2 kB ▼ -263 B (-1.06% ) 24.6 kB
InputBase ▼ -483 B (-0.64% ) 75.2 kB ▼ -262 B (-1.10% ) 23.5 kB
NativeSelect ▼ -480 B (-0.59% ) 81.6 kB ▼ -357 B (-1.37% ) 25.7 kB
FormHelperText ▼ -386 B (-0.57% ) 67.9 kB ▼ -200 B (-0.94% ) 21 kB
List ▼ -386 B (-0.57% ) 66.8 kB ▼ -194 B (-0.93% ) 20.8 kB
MenuList ▼ -386 B (-0.54% ) 70.5 kB ▼ -194 B (-0.87% ) 22 kB
RadioGroup ▼ -386 B (-0.56% ) 68.4 kB ▼ -193 B (-0.90% ) 21.2 kB
Collapse ▼ -386 B (-0.52% ) 73.6 kB ▼ -192 B (-0.84% ) 22.7 kB
Paper ▼ -386 B (-0.57% ) 66.9 kB ▼ -189 B (-0.90% ) 20.8 kB
Backdrop ▼ -386 B (-0.52% ) 73.2 kB ▼ -187 B (-0.82% ) 22.6 kB
Menu ▼ -386 B (-0.41% ) 94.1 kB ▼ -184 B (-0.63% ) 29 kB
Popover ▼ -386 B (-0.43% ) 88.4 kB ▼ -184 B (-0.67% ) 27.3 kB
ButtonBase ▼ -386 B (-0.49% ) 78.1 kB ▼ -180 B (-0.73% ) 24.5 kB
Fade ▼ -386 B (-1.31% ) 29 kB ▼ -173 B (-1.76% ) 9.67 kB
Grow ▼ -386 B (-1.29% ) 29.6 kB ▼ -172 B (-1.71% ) 9.88 kB
styles/createMuiTheme ▼ -386 B (-1.73% ) 22 kB ▼ -163 B (-2.10% ) 7.58 kB
Slide ▼ -386 B (-1.24% ) 30.8 kB ▼ -162 B (-1.57% ) 10.1 kB
MenuItem ▼ -385 B (-0.47% ) 82.3 kB ▼ -181 B (-0.70% ) 25.8 kB
ListItem ▼ -385 B (-0.47% ) 81.2 kB ▼ -177 B (-0.69% ) 25.4 kB
StepContent ▼ -383 B (-0.51% ) 74.8 kB ▼ -303 B (-1.28% ) 23.3 kB
BottomNavigationAction ▼ -383 B (-0.48% ) 79.6 kB ▼ -252 B (-0.99% ) 25.2 kB
CardActionArea ▼ -383 B (-0.48% ) 79.2 kB ▼ -242 B (-0.96% ) 25 kB
GridListTileBar ▼ -383 B (-0.56% ) 67.7 kB ▼ -236 B (-1.10% ) 21.2 kB
CardMedia ▼ -383 B (-0.57% ) 66.9 kB ▼ -235 B (-1.11% ) 20.9 kB
BottomNavigation ▼ -383 B (-0.57% ) 66.9 kB ▼ -234 B (-1.11% ) 20.9 kB
Card ▼ -383 B (-0.57% ) 67.4 kB ▼ -234 B (-1.10% ) 21 kB
ListItemAvatar ▼ -383 B (-0.57% ) 66.6 kB ▼ -231 B (-1.10% ) 20.8 kB
CardContent ▼ -383 B (-0.57% ) 66.5 kB ▼ -230 B (-1.10% ) 20.7 kB
Divider ▼ -383 B (-0.57% ) 67.2 kB ▼ -230 B (-1.08% ) 21.1 kB
ExpansionPanelActions ▼ -383 B (-0.57% ) 66.6 kB ▼ -230 B (-1.09% ) 20.8 kB
ListItemSecondaryAction ▼ -383 B (-0.57% ) 66.5 kB ▼ -230 B (-1.10% ) 20.8 kB
DialogActions ▼ -383 B (-0.57% ) 66.6 kB ▼ -229 B (-1.09% ) 20.8 kB
FormGroup ▼ -383 B (-0.57% ) 66.5 kB ▼ -229 B (-1.09% ) 20.8 kB
GridList ▼ -383 B (-0.57% ) 67 kB ▼ -229 B (-1.08% ) 21 kB
SnackbarContent ▼ -383 B (-0.56% ) 68.1 kB ▼ -229 B (-1.06% ) 21.3 kB
DialogContent ▼ -383 B (-0.57% ) 66.7 kB ▼ -228 B (-1.08% ) 20.8 kB
Box ▼ -383 B (-0.52% ) 73.4 kB ▼ -227 B (-1.01% ) 22.2 kB
ExpansionPanelDetails ▼ -383 B (-0.57% ) 66.5 kB ▼ -227 B (-1.08% ) 20.7 kB
CardActions ▼ -383 B (-0.57% ) 66.6 kB ▼ -226 B (-1.08% ) 20.8 kB
Step ▼ -383 B (-0.57% ) 67.2 kB ▼ -225 B (-1.06% ) 21 kB
StepConnector ▼ -383 B (-0.57% ) 67.3 kB ▼ -224 B (-1.05% ) 21.1 kB
Toolbar ▼ -383 B (-0.57% ) 66.8 kB ▼ -223 B (-1.05% ) 20.9 kB
ListItemIcon ▼ -383 B (-0.57% ) 66.7 kB ▼ -221 B (-1.05% ) 20.8 kB
Stepper ▼ -383 B (-0.55% ) 69.4 kB ▼ -221 B (-1.00% ) 21.8 kB
TableBody ▼ -383 B (-0.57% ) 66.7 kB ▼ -221 B (-1.05% ) 20.8 kB
ScopedCssBaseline ▼ -383 B (-0.57% ) 67.4 kB ▼ -220 B (-1.03% ) 21 kB
TableContainer ▼ -383 B (-0.57% ) 66.5 kB ▼ -220 B (-1.05% ) 20.7 kB
TableHead ▼ -383 B (-0.57% ) 66.7 kB ▼ -220 B (-1.05% ) 20.8 kB
TreeView ▼ -383 B (-0.52% ) 72.9 kB ▼ -220 B (-0.95% ) 22.8 kB
TableFooter ▼ -383 B (-0.57% ) 66.7 kB ▼ -219 B (-1.04% ) 20.8 kB
CssBaseline ▼ -383 B (-0.57% ) 66.5 kB ▼ -218 B (-1.04% ) 20.8 kB
Table ▼ -383 B (-0.57% ) 67.1 kB ▼ -218 B (-1.03% ) 21 kB
TableRow ▼ -383 B (-0.57% ) 67 kB ▼ -218 B (-1.03% ) 21 kB
ExpansionPanel ▼ -383 B (-0.49% ) 77.2 kB ▼ -216 B (-0.88% ) 24.3 kB
Skeleton ▼ -383 B (-0.56% ) 67.7 kB ▼ -212 B (-0.98% ) 21.3 kB
TabPanel ▼ -383 B (-0.57% ) 67.4 kB ▼ -211 B (-0.99% ) 21 kB
Grid ▼ -383 B (-0.55% ) 69.6 kB ▼ -206 B (-0.94% ) 21.8 kB
Zoom ▼ -383 B (-1.30% ) 29.1 kB ▼ -166 B (-1.66% ) 9.81 kB
GridListTile ▼ -381 B (-0.56% ) 68.2 kB ▼ -247 B (-1.15% ) 21.3 kB
@material-ui/utils ▲ +359 B (+5.26% ) 7.19 kB ▲ +158 B (+6.45% ) 2.61 kB
StepLabel ▼ -319 B (-0.43% ) 73.1 kB ▼ -185 B (-0.81% ) 22.6 kB
Typography ▼ -319 B (-0.47% ) 68.2 kB ▼ -184 B (-0.86% ) 21.2 kB
InputLabel ▼ -319 B (-0.45% ) 69.9 kB ▼ -183 B (-0.84% ) 21.5 kB
FormLabel ▼ -319 B (-0.47% ) 68 kB ▼ -179 B (-0.84% ) 21 kB
LinearProgress ▼ -319 B (-0.45% ) 70 kB ▼ -179 B (-0.82% ) 21.6 kB
IconButton ▼ -319 B (-0.40% ) 80.3 kB ▼ -178 B (-0.70% ) 25.1 kB
SvgIcon ▼ -319 B (-0.47% ) 67.6 kB ▼ -178 B (-0.84% ) 21 kB
StepIcon ▼ -319 B (-0.46% ) 69.2 kB ▼ -177 B (-0.82% ) 21.5 kB
Avatar ▼ -319 B (-0.46% ) 69.7 kB ▼ -175 B (-0.80% ) 21.8 kB
TabScrollButton ▼ -319 B (-0.39% ) 81.1 kB ▼ -173 B (-0.68% ) 25.4 kB
Fab ▼ -319 B (-0.39% ) 81 kB ▼ -172 B (-0.68% ) 25.3 kB
Button ▼ -319 B (-0.38% ) 83.9 kB ▼ -171 B (-0.66% ) 25.7 kB
Pagination ▼ -319 B (-0.36% ) 88.7 kB ▼ -170 B (-0.62% ) 27.3 kB
Tabs ▼ -319 B (-0.35% ) 90.3 kB ▼ -168 B (-0.59% ) 28.2 kB
PaginationItem ▼ -319 B (-0.37% ) 85 kB ▼ -167 B (-0.63% ) 26.2 kB
Chip ▼ -319 B (-0.37% ) 86.9 kB ▼ -166 B (-0.62% ) 26.6 kB
Autocomplete ▼ -319 B (-0.23% ) 136 kB ▼ -164 B (-0.38% ) 42.7 kB
Drawer ▼ -319 B (-0.35% ) 90.6 kB ▼ -164 B (-0.59% ) 27.6 kB
Tooltip ▼ -319 B (-0.30% ) 107 kB ▼ -154 B (-0.45% ) 33.9 kB
@material-ui/lab ▼ -318 B (-0.15% ) 217 kB ▼ -178 B (-0.27% ) 64.7 kB
FormControl ▼ -318 B (-0.46% ) 69 kB ▼ -173 B (-0.80% ) 21.4 kB
Snackbar ▼ -316 B (-0.39% ) 81.2 kB ▼ -233 B (-0.91% ) 25.4 kB
Link ▼ -316 B (-0.44% ) 71.2 kB ▼ -232 B (-1.02% ) 22.4 kB
MobileStepper ▼ -316 B (-0.43% ) 72.5 kB ▼ -230 B (-1.00% ) 22.7 kB
Slider ▼ -316 B (-0.39% ) 80.6 kB ▼ -229 B (-0.89% ) 25.6 kB
ToggleButtonGroup ▼ -316 B (-0.46% ) 67.9 kB ▼ -228 B (-1.06% ) 21.2 kB
CardHeader ▼ -316 B (-0.45% ) 69.6 kB ▼ -225 B (-1.02% ) 21.8 kB
DialogTitle ▼ -316 B (-0.46% ) 68.9 kB ▼ -225 B (-1.03% ) 21.6 kB
DialogContentText ▼ -316 B (-0.46% ) 68.6 kB ▼ -224 B (-1.03% ) 21.5 kB
InputAdornment ▼ -316 B (-0.45% ) 69.7 kB ▼ -224 B (-1.01% ) 21.9 kB
AppBar ▼ -316 B (-0.46% ) 68.6 kB ▼ -223 B (-1.03% ) 21.4 kB
Container ▼ -316 B (-0.46% ) 67.8 kB ▼ -223 B (-1.05% ) 21.1 kB
ListItemText ▼ -316 B (-0.45% ) 69.6 kB ▼ -220 B (-1.00% ) 21.8 kB
SwipeableDrawer ▼ -316 B (-0.32% ) 98.1 kB ▼ -220 B (-0.71% ) 30.7 kB
SpeedDialIcon ▼ -316 B (-0.46% ) 69.1 kB ▼ -218 B (-1.00% ) 21.6 kB
Dialog ▼ -316 B (-0.36% ) 88.5 kB ▼ -216 B (-0.77% ) 27.7 kB
Icon ▼ -316 B (-0.47% ) 67.4 kB ▼ -215 B (-1.01% ) 21 kB
AlertTitle ▼ -316 B (-0.46% ) 68.8 kB ▼ -214 B (-0.98% ) 21.5 kB
Checkbox ▼ -316 B (-0.36% ) 86.3 kB ▼ -214 B (-0.78% ) 27.2 kB
SpeedDialAction ▼ -316 B (-0.26% ) 123 kB ▼ -214 B (-0.54% ) 39.1 kB
FormControlLabel ▼ -316 B (-0.45% ) 70.1 kB ▼ -213 B (-0.96% ) 21.9 kB
TableSortLabel ▼ -316 B (-0.39% ) 81.6 kB ▼ -212 B (-0.81% ) 25.8 kB
CircularProgress ▼ -316 B (-0.46% ) 68.7 kB ▼ -210 B (-0.96% ) 21.6 kB
TreeItem ▼ -316 B (-0.39% ) 80.6 kB ▼ -210 B (-0.81% ) 25.6 kB
ListSubheader ▼ -316 B (-0.47% ) 67.3 kB ▼ -209 B (-0.98% ) 21.1 kB
AvatarGroup ▼ -316 B (-0.44% ) 70.8 kB ▼ -208 B (-0.92% ) 22.4 kB
TableCell ▼ -316 B (-0.46% ) 68.6 kB ▼ -208 B (-0.96% ) 21.5 kB
ToggleButton ▼ -316 B (-0.39% ) 80.3 kB ▼ -208 B (-0.81% ) 25.4 kB
TabList ▼ -316 B (-0.34% ) 91.5 kB ▼ -206 B (-0.70% ) 29.2 kB
Hidden ▼ -316 B (-0.45% ) 70.6 kB ▼ -199 B (-0.89% ) 22.1 kB
Rating ▼ -316 B (-0.42% ) 75.4 kB ▼ -199 B (-0.82% ) 24.2 kB
Badge ▼ -316 B (-0.45% ) 69.9 kB ▼ -198 B (-0.91% ) 21.7 kB
ButtonGroup ▼ -316 B (-0.36% ) 87.6 kB ▼ -197 B (-0.73% ) 27 kB
ExpansionPanelSummary ▼ -316 B (-0.38% ) 82.3 kB ▼ -197 B (-0.75% ) 26 kB
Radio ▼ -316 B (-0.36% ) 87.4 kB ▼ -191 B (-0.69% ) 27.6 kB
Switch ▼ -316 B (-0.37% ) 85.6 kB ▼ -191 B (-0.71% ) 26.8 kB
Tab ▼ -316 B (-0.39% ) 80.7 kB ▼ -191 B (-0.74% ) 25.6 kB
Alert ▼ -316 B (-0.36% ) 87.5 kB ▼ -189 B (-0.68% ) 27.6 kB
Breadcrumbs ▼ -316 B (-0.37% ) 84.7 kB ▼ -189 B (-0.70% ) 26.8 kB
SpeedDial ▼ -314 B (-0.34% ) 91.3 kB ▼ -217 B (-0.74% ) 28.9 kB
StepButton ▼ -314 B (-0.36% ) 86.5 kB ▼ -211 B (-0.77% ) 27.3 kB
colorManipulator ▲ +181 B (+4.57% ) 4.14 kB ▲ +79 B (+5.08% ) 1.63 kB
docs:/_app ▲ +100 B (+0.27% ) 37.4 kB -- -1 B
@material-ui/system -- 17.2 kB ▲ +3 B (+0.07% ) 4.52 kB
Portal -- 2.87 kB ▲ +3 B (+0.23% ) 1.29 kB
NoSsr -- 2.18 kB ▼ -2 B (-0.19% ) 1.03 kB
RootRef -- 4.64 kB ▼ -2 B (-0.11% ) 1.76 kB
TextareaAutosize -- 5.24 kB ▲ +2 B (+0.09% ) 2.19 kB
Unstable_TrapFocus -- 3.85 kB ▲ +2 B (+0.13% ) 1.59 kB
@material-ui/styles -- 52.1 kB ▲ +1 B (+0.01% ) 15.6 kB
Modal -- 15.1 kB ▼ -1 B (-0.02% ) 5.27 kB
TabContext -- 2.65 kB ▲ +1 B (+0.09% ) 1.15 kB
useMediaQuery -- 2.57 kB ▲ +1 B (+0.09% ) 1.06 kB
useScrollTrigger -- 2.66 kB ▲ +1 B (+0.09% ) 1.08 kB
ClickAwayListener -- 4.13 kB -- 1.66 kB
docs:/ -- 12.5 kB -- -1 B
Popper -- 28.8 kB -- 10.3 kB
useAutocomplete -- 14.5 kB -- 5.2 kB

Generated by 🚫 dangerJS against f3058db

@github-actions github-actions bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged label May 28, 2020
@eps1lon eps1lon marked this pull request as draft May 29, 2020 10:47
@eps1lon eps1lon force-pushed the feat/minify-errors branch 2 times, most recently from 032a996 to b925316 Compare May 30, 2020 15:09
@eps1lon eps1lon marked this pull request as ready for review May 30, 2020 15:23
@github-actions github-actions bot added the PR: out-of-date The pull request has merge conflicts and can't be merged label May 31, 2020
eps1lon added 14 commits May 31, 2020 13:10
Avoids dealing with custom module resolution
or accidentally publishing the file
Otherwise they end up as empty string literals
in NODE_ENV=test
Don't fully understand why babel needs raw and cooked values
I don't think I fully understand them.
Let's not deal with them in strings for code examples.
@github-actions github-actions bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged label May 31, 2020
Copy link
Member

@oliviertassinari oliviertassinari left a comment

Choose a reason for hiding this comment

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

Great work, it sounds like we will be able to add more "invariant" like checks :)

  • How is versioning of the errors handled?
    It seems to be based on an incremental logic. Correct? This sounds smart.
    I assume it also solves the ordering issue (no guarantee on which order the Babel will parse the files).
  • I think that we have a couple of improvement opportunities for the design of the /production-error page. What do you think about these points:

test/regressions/index.js Outdated Show resolved Hide resolved
Co-authored-by: Olivier Tassinari <olivier.tassinari@gmail.com>
@eps1lon
Copy link
Member Author

eps1lon commented Jun 2, 2020

I think that we should leverage the box-shadow as little as possible

I don't think so. Elevation has a defined semantic in Material design.

maybe using the Alert component?

This is not an alert.

We apply the wrong variant to the body element: body2

Should be done in a separate PR. If we apply the wrong typography class, I don't see how this is tied to this PR.

@oliviertassinari
Copy link
Member

oliviertassinari commented Jun 2, 2020

@eps1lon We have started to look for a designer to help us, to revamp the landing page, to improve the layout of the documentation, to build the design of the enterprise product marketing pages, etc. I think that progressively, we will move away from the default look of Material Design, for the design of material-ui.com (not the components). I think that we need to find a design that allows resonating with the different themes we want to provide by default, on top of the default Material Design look. Ideally, I wish we could cover:

  • the do it yourself market: unstyled
  • the build a custom design system market: a bear look, something people can easily override on top of, with the minimum defaults.
  • the desktop admin and Android market: Material Design
  • the Chinese market: a theme close to Element / Antd / rsuite
  • the marketing landing pages market (Gatsby, Next.js), with a theme close to Bootstrap, Chakra UI, Sancho UI.
  • the mobile market: iOS spec

Regarding the very case, I would be cautious with this rule "Don’t use shadows for style only".

https://material.io/design/environment/elevation.html#depicting-elevation

In the long term, I think that we should defer design decisions to a UI/UX designer, when possible.

@eps1lon
Copy link
Member Author

eps1lon commented Jun 2, 2020

Great, but unrelated to this PR.

@oliviertassinari
Copy link
Member

What do you think of this recommendation?

Capture d’écran 2020-06-02 à 12 00 43

@eps1lon
Copy link
Member Author

eps1lon commented Jun 2, 2020

It's not for styles only. It outlines the container that holds the error. The container has a meaning that is expressed via styles.

@github-actions github-actions bot added the PR: out-of-date The pull request has merge conflicts and can't be merged label Jun 3, 2020
Was extracted into module for usage in separate extract-errors scrip.
Since we no longer plan on doing this we can inline
@eps1lon eps1lon removed the PR: out-of-date The pull request has merge conflicts and can't be merged label Jun 3, 2020
@eps1lon
Copy link
Member Author

eps1lon commented Jun 3, 2020

Considering the upvotes as approvals. Other review does not have actionable items.

@eps1lon eps1lon merged commit 3a7d4c6 into mui:master Jun 3, 2020
@eps1lon eps1lon deleted the feat/minify-errors branch June 3, 2020 19:43
@oliviertassinari
Copy link
Member

oliviertassinari commented Jun 3, 2020

@eps1lon Awesome!

They might be potential by giving a second iteration on the design of the error on the documentation but I think that we should wait to see the traffic on the new page. We probably want to have enough traffic on the page before spending more time on it (assuming we ask a designer to do so, there are pages with more leverage :D).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants