Open anttih opened 9 years ago
One workaround is to add the jQuery require
in whichever application relies on jQuery. For example:
Main.ps
foreign import jQuery :: Foreign
...
Main.js
"use strict";
var jQuery = require('jquery');
window.jQuery = jQuery;
exports.jQuery = jQuery;
The FFI code relies on the
jQuery
global var which makes it difficult to bundle all the deps with browserify. If one of your dependencies hasrequire('jquery')
in there and you use browserify to bundle those deps, you will end up with two jquerys on the page: one included with a script tag (to have jQuery available as a global) and one in the bundle. There may be hacks to get around this (setting jQuery as global somewhere at the top level), but I wouldn't want to do that. I think this day and age, one should bundle all the deps anyway.So, what I suggest is we add
var jQuery = require('jquery')
in the FFI code.