I am currently working on a Brunch project with version 2.8.2. This particular version of Brunch is compatible with front-end dependencies through NPM. Additionally, I have integrated the Typescript Brunch plugin and successfully implemented import $ = require("jquery")
in my code.
However, I am facing an issue when it comes to loading a JQuery plugin for use in my project.
Simply adding the plugin to package.json does not result in it appearing in my compiled vendor.js
file as expected, since it is not required anywhere in the codebase.
The method of using
npm: {
globals: {
"$": "jquery-validation"
}
}
is effective for making JQuery a global variable, but it seems that this approach does not work for loading the jquery-validation
plugin as it depends on JQuery itself and does not export its own module.
Attempting to require("jquery-validation")
in my Typescript code is also unsuccessful due to the plugin's .d.ts
file correctly defining it as an extension of JQuery rather than a standalone module.
Is there a solution to achieve what I am attempting to do?