Fluentui: use "loadTheme" method will include the whole "office-ui-fabric-react" lib

Created on 19 Jan 2019  路  3Comments  路  Source: microsoft/fluentui

I try to change theme following official doc, likes:
import { loadTheme as setup } from 'office-ui-fabric-react';

But this line will make the whole "office-ui-fabric-react" lib bundled by webpack. My app.js file is up to 3MB+.

Can I improve this? What is the best way to do it?

styling

Most helpful comment

Thanks for chiming in @cslecours. This should fix your issue @jayliang701, feel free to re-open the issue if it doesn't.

All 3 comments

You should use :
import { loadTheme } from 'office-ui-fabric-react/lib/Styling';

Source : https://github.com/OfficeDev/office-ui-fabric-react/blob/master/apps/fabric-website-resources/src/components/pages/ColorsPage.tsx#L5

Thanks for chiming in @cslecours. This should fix your issue @jayliang701, feel free to re-open the issue if it doesn't.

Thank you guys!

Was this page helpful?
0 / 5 - 0 ratings