Forum Discussion
snaffle
8 years agoExpert
Yes it works, but that wasn't the problem.
Thanks for your suggestions anyway.
ttadej
8 years agoAdvisor
Great question. We did this with Browserify Shim.
You'd do something like this in your package.json:
"browserify-shim": {
"jQuery": "global:LITHIUM.jQuery"
}
Then in your bundle you can import Lithium's jQuery
const $ = require('jQuery')
More info here: https://github.com/thlorenz/browserify-shim
OR...
A less elegant way might be something like:
var $ = window.LITHIUM.jQuery || {};
You'd want to put your script includes in last_chance_html to ensure the Lithium object has loaded by the time your files load and make the assignment. I wouldn't recommend this, but it might work as a quick solution.