search

Home  >  Q&A  >  body text

javascript - How does material-ui implement the introduction of a single component?

Material-ui can directly introduce the entire library, but sometimes only the required components, such as AppBar, are introduced in order to reduce the size of js.

import AppBar from 'material-ui/AppBar';

In this way, only the AppBar component will be introduced, and the entire material-ui will not be introduced, thus reducing the size of the packaged js.
My question is main in package.json specifies the entry file for each package. In this case, how is the introduction of a single component implemented, that is, material -How is the bar in ui/AppBar implemented?

黄舟黄舟2737 days ago572

reply all(1)I'll reply

  • 高洛峰

    高洛峰2017-05-31 10:42:08

    In fact, by default, you first go to the root directory node_modules/material-ui/AppBar
    You will know after you go to node_modules/material-ui and take a look

    reply
    0
  • Cancelreply