web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details
Power Pages - Power Apps Portals
Answered

How to import js file to custom javascript

Like (0) ShareShare
ReportReport
Posted on 8 Jan 2022 04:15:33 by Microsoft Employee

Hi all,

 

I'm working on a powerapp task. My app has a 'Page' with a 'Web Form', it has 'Web Form Step' for sure. And I have some logics in the 'Web Form Step' -> 'Custom JavaScript'. 

Now I have an external .js file, which exports some functions I want to import to the 'Custom JavaScript'. I uploaded it to 'Web Files', and named the partial url 'myFileName.js'; I added '<script type="module" src="/myFileName.js"></script>' to 'Web Page' -> 'Content Page' -> 'Content' -> 'Copy (HTML)'.

Then if I added 'import { functionName } from "/myFileName.js";' to 'Web Form Step' -> 'Custom JavaScript', the page will lose all behaviors added by the custom js, so basically the custom js broke down by the 'import' part.

 

Any suggestion for this?

  • Verified answer
    oliver.rodrigues Profile Picture
    9,342 Most Valuable Professional on 10 Jan 2022 at 17:45:50
    Re: How to import js file to custom javascript

    @joeyzy123 usually when importing JS I simply use:

    <script src="/MYJS.js"></script>

    I normally add that to the Tracking Code content snippet.. this way it's loaded on every page, but you can also do that at the page level

     

Helpful resources

Quick Links

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Pages

#1
Lucas001 Profile Picture

Lucas001 60 Super User 2025 Season 2

#2
Fubar Profile Picture

Fubar 55 Super User 2025 Season 2

#3
surya narayanan Profile Picture

surya narayanan 35