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

820
Views
Vite build warns: script can't be bundled without type="module" attribute
<!-- index.html -->
<script src="https://cdn.jsdelivr.net/npm/js-cookie@rc/dist/js.cookie.min.js"></script>
<script type="module" src="./scripts/auth.js"></script>

# Vite terminal after running "npm run build"
build started...
<script src="https://cdn.jsdelivr.net/npm/js-cookie@rc/dist/js.cookie.min.js">
in "/index.html" can't be bundled without type="module" attribute

I'm trying to add some external scripts to my index.html but the Vite build process assumes I want to have these scripts bundled. Is there any way to suppress this message?

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

0

I think I figured it out, but as always ymmv.

You might be able to do this in main.js or app.vue if you need it global, but I only needed the external script on one page. The old-school approach seemed to do it:

    mounted() {
      let externalScript = document.createElement('script');
      externalScript.setAttribute('src', 'https://[scripturletc].min.js')
      document.head.appendChild(externalScript)
    }

note: if you're doing your components in the new vue3 way, I think the above lines would go in your setup block.

about 4 years ago · Juan Pablo Isaza Report

0

There is an easy answer, and it is actually in the log itself.

Just add the type="module" attribute to your script tags.

like so: <script type="module" src="/src/main.js"></script>

Hope it helps.

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!