Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

326
Views
Angular 12 load external scripts as type module

Is it possible to set Angular to load external scripts defined in the angular.json under architect/build/options/scripts as type="module"?

When running Angular I can see the automatically injected script tags like this:

<script src="runtime.js" type="module"></script>
<script src="polyfills.js" type="module"></script>
<script src="styles.js" type="module"></script>
<script src="scripts.js" defer></script>
<script src="vendor.js" type="module"></script>
<script src="main.js" type="module"></script>

The scripts.js has a defer attribute, but not type="module". I'm trying to load a Stencil JS Web Component installed via npm into my app. The Stencil Component Script needs to be loaded as module, otherwise the other imports won't work.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

I can also confirm it's not currently possible to add a type attribute to the scripts field. Possible values are: object with inject|lazy|bundleName|input attributes or directly a string.

To use a WebComponent in Angular, I ended up adding an import statement into the polyfills.ts file

import 'node_modules/my-web-components/dist/example.js';

I was able to see the content imported correctly and my web component was active in my angular component html file. content added here

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!