I am trying to use jQuery UI in StackBlitz.

I am also trying to install it as a dependency and without a script tag.

I understand that I have to add @types/jquery and @types/jqueryui as dependencies.

But when I add this in the index.ts

import $ from "jquery"; import "jqueryui"; 

I get the error: "jQuery is not defined"

3

1 Answer

This code seems to do the trick:

import $ from "jquery"; declare var global: any global.jQuery = $; import "jqueryui"; 

Here is a screenshot of the dependencies:

enter image description here

1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.