-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Which is the proper way to work with npm modules and browserify? #1878
Comments
The NPM releases are created dynamically from source using a build script. The You can check out what the script is doing here with these regex. I haven't had much time testing single component releases with npm. It would be really helpful if you can provide any feedback that will help me update the regexp to patch issues you are encountering If you are interested in patching with PR you can run the build script locally using gulp "create components"
# or
gulp release |
I'll try to make them work and provide feedback, although it's my first app with browserify and I'm not confident of finding a good solution. Until everything with the modules is sorted out, another way to make everything work easily is to use browserify-shim to expose jquery to semantic-ui in your package.json.
Then, in any view in the app you could just Thanks for your wonderful library and the amount of effort you're putting in it. |
Update: possible solution I'm experiencing the same issues with I believe I have found the issue:
When generating Possible solution:
to
should do the trick I hope. |
I'll take a look at this today |
Will release with patch today. |
Closing, will re-open if anyone sees any continuing issues |
This patch causes a syntax error in https://github.com/Semantic-Org/UI-Site/blob/master/index.js (line 13). /*!
* # Semantic UI 2.0.7 - Site
* http://github.com/semantic-org/semantic-ui/
*
*
* Copyright 2015 Contributors
* Released under the MIT license
* http://opensource.org/licenses/MIT
*
*/
;(function ( $, window, document, undefined ) {
$.site = var _module = module;
module.exports = function(parameters) { |
I'm pretty sure automatically creating modules via regExp is a terrible monkeypatch. Sorry about these kinds of bugs. |
I agree, the RegExp approach is not very solid. No need to appologise though. I guess refactoring each component to have built-in support for UMD/CommonJS would be the proper solution. |
Pull request 2816 (attached above) should take care of the issues described by @trigoesrodrigo and @chessels (as well as a similar issue with the api component). @jlukic if everything looks good can you please do a new npm release for us? Thanks! |
I'll take a look at this specifically for a patch monday. Still coralling things together for a larger |
Fixes npm packaging for components api, site (#1878) and transition.
Hi. I'm trying to use some of the SUI modules inside an application in which I'm already using Browserify and npm modules.
I found some problems while trying to get the modules to work.
So far I've tried four modules: semantic-ui-checkbox, semantic-ui-dropdown, semantic-ui-tab and semantic-ui-modal.
With semantic-ui-checkbox everything worked properly with the following code:
However, with the other three modules I've encountered problems:
$.fn.transition = require('semantic-ui-transition')
because this time the module does it automatically -I think either all modules should do that or none, otherwise it could be misleading-). After trying that, the error is different andUncaught ReferenceError: _module is not defined
pops up in this line after I click the menu.Uncaught TypeError: Cannot read property 'exports' of undefined
pops up in line when I invoke `.tab() on the DOM elements.$.fn.dimmer = require('semantic-ui-dimmer')
. After doing that,Uncaught ReferenceError: _module is not defined
pops up in line when I invoke the modal. It looks as the same error as with the dropdown module.Am I doing something wrong? Are there any examples of using that modules in a browserify environment?
Thanks in advance.
The text was updated successfully, but these errors were encountered: