node.js - Shimming jQuery nodes for browserify -
i have file requires module installed npm:
-- login.js -- require('jquery-form'); the module relies on jquery variable existing in window scope i'm browserifying this, understand need shim it. i've installed browserify-shim , using (from package.json):
"browserify-shim": { "./node_modules/jquery/dist/jquery.js": "jquery" }, however, when jquery-form runs, jquery not defined. missing?
you need "shim" jquery dependency of jquery-form. if these installed via npm there no need because browser directive.jquery-form doesn't have main directive in package.json need add browser directive show browserify file include in bundle.
"browserify-shim": { "jquery-form": { "depends": ["jquery"] }, "browserify": { "transform": [ "browserify-shim" ] }, "browser": { "jquery-form": "./node_modules/jquery-form/jquery.form.js" }, see this section of docs.
Comments
Post a Comment