How Can I Use jQuery Ui (Jqueryui) with Stackblitz and Typescript and Npm

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:

1

Your Answer

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.

David Miller

David Miller

Executive Financial & Market Analyst

David Miller brings 15 years of experience in global economics, personal finance strategy, and market dynamics. He specializes in turning complex economic trends into actionable insights for everyday readers.

Share this article
Twitter Facebook Pinterest