Skip to content

Importing single module bundles entire library #1025

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

Closed
pranjalk opened this issue Dec 13, 2016 · 2 comments
Closed

Importing single module bundles entire library #1025

pranjalk opened this issue Dec 13, 2016 · 2 comments

Comments

@pranjalk
Copy link

pranjalk commented Dec 13, 2016

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

@levithomason
Copy link
Member

Duplicate #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.

@pranjalk
Copy link
Author

@levithomason Thanks!

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