Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
jonespossibly
Advocate I
Advocate I

Current method for importing external libraries?

So, I want to import bootstrap (https://getbootstrap.com/) and bootstrap-table (https://bootstrap-table.com/) into a visual i'm writing and the advice about how to add external libraries to the visual.ts seems to be a bit varying across different sources.

do i need to install via npm?  do i need to include the libraries in pbiviz.json externalJS?  do i use the CDN versions?

Do i need to separately install jquery?

 

i'm using:

powerbi-visuals-tools@4.0.4

"powerbi-visuals-api": "^3.8.4"

 

1 ACCEPTED SOLUTION
dm-p
Super User
Super User

Hi @jonespossibly,

There were a lot of changes in v3 of the SDK  introduce Webpack and to mitigate the amount of additional work, so some older guides will likely include all the additional steps for tsconfig.json and pbiviz.json that you needed to make dependencies work previously.

You're best loading as much as you can via npm so that everything's bundled at build time. Loading libraries over the web can be tricky if the endpoint is not permissive enough to deal with the CORS restrictions in the sandboxed iframe.

npm install [package] --save-dev  is sufficient to make sure that your project has the dependency.

Webpack will bundle what you import in your source (providing there's a loader for it). With libraries that support TypeScript, this usually just works.

You can probably take a look at any of my production visuals on GitHub to get an idea of what the key files might look like - these all seem to be okay with just loading via npm and Webpack handling the imports via the usual build process.

Bootstrap can be installed via npm, but it uses sass (the SDK uses less) - therefore you're need to load the distribution .css file in your main visual entry point, kind of like this (I have used it previously, but don't think I ever put one into production, so I don't have any source I can link; the principle is the same though).

Last time I used Bootstrap, jQuery was it was optional, depending on whether you wanted to use the dynamic stuff or not (I think we also had to install popper.js on older versions for tooltips etc., although it looks like it might be streamlined now to just the bootstrap package). Although, if you specifically want jQuery, then it's best to install it via npm separately so that you get the version you want.

Regards,

Daniel





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!


On how to ask a technical question, if you really want an answer (courtesy of SQLBI)




View solution in original post

2 REPLIES 2
jonespossibly
Advocate I
Advocate I

As usual, an excellent and detailed informative answer.

You sir, are a legend.

dm-p
Super User
Super User

Hi @jonespossibly,

There were a lot of changes in v3 of the SDK  introduce Webpack and to mitigate the amount of additional work, so some older guides will likely include all the additional steps for tsconfig.json and pbiviz.json that you needed to make dependencies work previously.

You're best loading as much as you can via npm so that everything's bundled at build time. Loading libraries over the web can be tricky if the endpoint is not permissive enough to deal with the CORS restrictions in the sandboxed iframe.

npm install [package] --save-dev  is sufficient to make sure that your project has the dependency.

Webpack will bundle what you import in your source (providing there's a loader for it). With libraries that support TypeScript, this usually just works.

You can probably take a look at any of my production visuals on GitHub to get an idea of what the key files might look like - these all seem to be okay with just loading via npm and Webpack handling the imports via the usual build process.

Bootstrap can be installed via npm, but it uses sass (the SDK uses less) - therefore you're need to load the distribution .css file in your main visual entry point, kind of like this (I have used it previously, but don't think I ever put one into production, so I don't have any source I can link; the principle is the same though).

Last time I used Bootstrap, jQuery was it was optional, depending on whether you wanted to use the dynamic stuff or not (I think we also had to install popper.js on older versions for tooltips etc., although it looks like it might be streamlined now to just the bootstrap package). Although, if you specifically want jQuery, then it's best to install it via npm separately so that you get the version you want.

Regards,

Daniel





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!


On how to ask a technical question, if you really want an answer (courtesy of SQLBI)




Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors