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

How can I get modules to work? #25

Open
Panoplos opened this issue Jul 27, 2017 · 2 comments
Open

How can I get modules to work? #25

Panoplos opened this issue Jul 27, 2017 · 2 comments

Comments

@Panoplos
Copy link

Panoplos commented Jul 27, 2017

I do not want to use react-semantic-ui because it is a pain getting modules like dropdown to render correctly. I have all the styles and actionless components working with only this build through some webpack magic, but I cannot get the js files to register.

Right now I have an app with a client.js entry that imports the following:

semantic.js

//Import jQuery and define for Semantic-UI-Less Modules
import jQuery from 'jquery'
window.jQuery = jQuery

// Import the styles.
import 'web/styles/site.less'

// Glob the module js requirements.
const importAll = r => { r.keys().forEach(r) }
importAll(require.context('semantic-ui-less/definitions/', true, /\.js$/))

The app.js build is inflated by a couple megs, and I confirmed the code in there, but I cannot perform any js actions on the modules. For instance, $.fn.* seems to be set in the semantic js code, but $.fn is undefined when I attempt to access it via console.

Any pointers on getting this working will be greatly appreciated.

Note that jQuery and $ are globally available when tested from console.

@Panoplos
Copy link
Author

Looks like I had to add

		new webpack.ProvidePlugin({
			$: 'jquery',
			jQuery: 'jquery',
			jquery: 'jquery',
			"window.jQuery": 'jquery'
		}),

to my webpack config to get this working... Hope this helps anyone else.

@JakobJingleheimer
Copy link

We didn't have any trouble getting SUIR to work—it worked right out of the box. It was SUI-Less that was a royal pain. If you're using React, mucking around with jQuery is a bad idea.

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