Semantic-ui-react: Importing single module bundles entire library

Created on 13 Dec 2016  路  2Comments  路  Source: Semantic-Org/Semantic-UI-React

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

Most helpful comment

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.

All 2 comments

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!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

eGust picture eGust  路  3Comments

devsli picture devsli  路  3Comments

ryanpcmcquen picture ryanpcmcquen  路  3Comments

saikrishnadeep picture saikrishnadeep  路  3Comments

hankthewhale picture hankthewhale  路  3Comments