-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
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
[test] Fix size snapshot including peer dependencies #14636
Conversation
@material-ui/core: parsed: -23.82% 😍, gzip: -29.70% 😍 Details of bundle changes.Comparing: ac57a7c...815ab0c
|
@oliviertassinari This looks about right. There are some minor increases in e.g. |
scripts/sizeSnapshot/create.js
Outdated
/* eslint-disable no-console */ | ||
const childProcess = require('child_process'); | ||
const fse = require('fs-extra'); | ||
const { flatten, fromPairs } = require('lodash'); |
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.
The downside of using named import is the friction it's creating when editing the code. We have to go to the top of the file to add the missing dependencies. What do you think of using a different tradeoff for the server side scripts, where we don't care about the bundle size?
const { flatten, fromPairs } = require('lodash'); | |
const lodash = require('lodash'); |
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.
Makes sense to me. Will change
Just creates diff noise if additional imports are used. There are little to no benefits for named imports in node
The programmatic API from
size-limit
does not use the same webpack config as the cli. Therefore peer dependencies were showing up in the snapshot.By using a custom webpack config we can exclude those and also properly set up aliases instead of using
yarn link
. This will also save the stats from webpack in a build artifact that can be inspected with e.g. https://chrisbateman.github.io/webpack-visualizer/ or http://webpack.github.io/analyse/