I have asked same question on Stackoverflow. I have given one working solution there which I can’t use in normal applications (requires editing inside
And I can’t use solution mentioned by me or
Leonardo Oliveira because Ionic application doesn’t contains
webpack.config.js outside of
The jquery.shorten is an old plugin which I want to import in Ionic using
This is how I am importing
import * as jQuery from 'jquery'; import 'jquery.shorten/src/jquery.shorten';
I have also tried following way -
import 'jquery'; declare let $: any; declare let jQuery: any; import 'jquery.shorten/src/jquery.shorten';
Both give error (on main page) -
jQuery is not defined
And in console -
Uncaught ReferenceError: jQuery is not defined. (points to line 151 of “jquery.shorten.js” which is “})(jQuery)”)
If I include CDN of
index.html, then things work perfectly. But this is the last solution I want.
I have also tried this solution. But generates random errors.
Does anybody know how to import old jQuery plugins using
import in Ionic? Or someway to use
angular-cli.json in this case?
My project is running on Ionic 3.9.2. And I can use jQuery in my project as it can be used.