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

177
Views
JavaScript: absolute URL as es-module address in imports

Is it possible to use absolute URLs for es6-modules import in browsers?

import something from 'https://example.com/js/lib/es6_module.mjs';

As I know, it is impossible for nodejs. I have the following error in this case:

Uncaught Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]: Only file and data URLs are supported by the default ESM loader. Received protocol 'https:'

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

0

you can use these

  • https://github.com/egoist/import-http.git for webpack/rollup
  • https://github.com/denoland/deno.git for js/ts runtime
about 4 years ago · Juan Pablo Isaza Report

0

Yes, it is possible. I've check it for browsers Chrome (94), Firefox (v93), Opera (v79).

This is HTML import:

<script type="module">
    import fn from 'https://example.com/module.mjs';
    fn();
</script>

This is es-module import:

import fn from 'https://exmaple.com/module.mjs';
fn();

Site example.com must have CORS enabled (apache config for example):

Header add Access-Control-Allow-Origin "*"
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!