Inspite of using import { Popup } from 'semantic-ui-react'; to import just the popup, the entire library gets imported in the bundle in webpack, Can someone please help me with this?
Semantic-UI-React version: 0.62.1
Duplicate https://github.com/Semantic-Org/Semantic-UI-React/issues/862, not yet supported.
Until we get a jsnext:main build to support tree shaking you can add babel-plugin-lodash as noted here to transform your import statements to individual file imports automatically.
It will automatically transform your imports:
import { Popup } from 'semantic-ui-react'
// becomes
import Popup from 'semantic-ui-react/dist/commonjs/modules/Popup'
Now, you're truly importing only the Popup module.
@levithomason Thanks!
Most helpful comment
Duplicate https://github.com/Semantic-Org/Semantic-UI-React/issues/862, not yet supported.
Until we get a
jsnext:mainbuild to support tree shaking you can addbabel-plugin-lodashas noted here to transform your import statements to individual file imports automatically.It will automatically transform your imports:
Now, you're truly importing only the Popup module.