Skip to content
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

Alternative to semantic-ui-react-less-loader #6

Open
skleeschulte opened this issue Jun 16, 2017 · 2 comments
Open

Alternative to semantic-ui-react-less-loader #6

skleeschulte opened this issue Jun 16, 2017 · 2 comments

Comments

@skleeschulte
Copy link

Just wanted to let you know, I published a Babel plugin that complements the semantic-ui-less-module-loader (and replaces/extends the functionality of semantic-ui-react-less-loader):
babel-plugin-transform-semantic-ui-react-imports

The reason is, I wanted to be able to write imports like import { Button } from 'semantic-ui-react', whereas semantic-ui-react-less-loader requires imports like import Button from 'semantic-ui-react/src/elements/Button'.

@gadyonysh
Copy link
Owner

@skleeschulte Looks great, thank you. In my projects I use babel-plugin-lodash, because semantic-ui-react imports lodash directly:

import _ from 'lodash'

Can your plugin also transform lodash imports to cherry-pick its modules?

@skleeschulte
Copy link
Author

Short answer: it does not transform lodash imports.

Long answer: If you do not explicitly import files from semantic-ui-react/src, you will be using the files from semantic-ui-react/dist/.../..., and these files are already built with babel-plugin-lodash. Using babel-plugin-lodash here should be a no-op.

However, my plugin replaces the functionality of babel-plugin-lodash with the configuration ["lodash", { "id": ["semantic-ui-react"] }]. You can read more about this in the RADME of my plugin.

If you import files from semantic-ui-react/src, you can simply activate both babel plugins (babel-plugin-lodash and babel-plugin-transform-semantic-ui-react-imports). Just make sure to not configure them to both mangle imports from semantic-ui-react.

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