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

Upgrade mdc web dependencies to 2.x #885

Closed
9 of 21 tasks
lucasecdb opened this issue May 26, 2019 · 1 comment
Closed
9 of 21 tasks

Upgrade mdc web dependencies to 2.x #885

lucasecdb opened this issue May 26, 2019 · 1 comment

Comments

@lucasecdb
Copy link
Contributor

lucasecdb commented May 26, 2019

these are the components that need to be upgraded:

  • @material/react-button
  • @material/react-card
  • @material/react-checkbox
  • @material/react-chips
  • @material/react-dialog
  • @material/react-drawer
  • @material/react-fab
  • @material/react-icon-button
  • @material/react-list has breaking change
  • @material/react-menu has breaking change
  • @material/react-radio
  • @material/react-ripple
  • @material/react-select
  • @material/react-snackbar
  • @material/react-switch
  • @material/react-tab-bar
  • @material/react-tab-indicator
  • @material/react-tab-scroller
  • @material/react-tab
  • @material/react-text-field
  • @material/react-top-app-bar has breaking change
@fjorgemota
Copy link

Now that 0.14 is released, I want to warn one thing related directly to this issue (which is the reason behind I decided to comment instead of creating a new issue): You should attempt to use 0.13 version instead of upgrading to 0.14 if you're using a mdc's react package that was updated + a mdc's react package that was not updated.

For example, I'm using @material/react-list and @material/react-drawer on a project. After updating to version 0.14, importing these two libraries inside one project built by webpack means that @material/list will be duplicated inside the bundle, because:

  1. Webpack cannot tree-shake the library; (given that @material/list's foundation.js only export MDCListFoundation)
  2. Different versions of the same library will be imported, so webpack cannot import the library just once (see below the yarn why @material/list output on my project);
yarn why v1.16.0
[1/4] Why do we have the module "@material/list"...?
[2/4] Initialising dependency graph...
[3/4] Finding dependency...
[4/4] Calculating file sizes...
=> Found "@material/list@2.3.0"
info Has been hoisted to "@material/list"
info Reasons this module exists
   - Hoisted from "@material#react-drawer#@material#list"
   - Hoisted from "@material#react-drawer#@material#drawer#@material#list"
info Disk size without dependencies: "1.5MB"
info Disk size with unique dependencies: "3.16MB"
info Disk size with transitive dependencies: "3.28MB"
info Number of shared dependencies: 10
=> Found "@material/react-list#@material/list@1.1.1"
info This module exists because "@material#react-list" depends on it.
info Disk size without dependencies: "600KB"
info Disk size with unique dependencies: "2.25MB"
info Disk size with transitive dependencies: "2.37MB"
info Number of shared dependencies: 10
Done in 1.07s.

On my project using these two libraries, I now get these warnings by webpack's dashboard:

webpack's warning about duplicate files

So...If you wanna avoid the duplicated file, I guess the best solution is just to stay at version 0.13, so webpack doesn't need to duplicate the files because 0.13 always use the same version of the @material/list package. The same should apply to different mdc's react packages, I guess, but I haven't tested it.

I also believe that it should not bring any conflicts because each package is isolated inside the webpack bundle. But I just wanted to document this small detail related to mdc's react that I observed on my project, that's directly related to this issue. :)

@lucasecdb lucasecdb closed this as not planned Won't fix, can't repro, duplicate, stale May 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants