parcel-bundler / parcel

The zero configuration build tool for the web. πŸ“¦πŸš€

Home Page:https://parceljs.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Development server inexplicably strips type="module" from <script> tag

gcleaves opened this issue Β· comments

πŸ› bug report

Development server inexplicably strips type="module" from <script> tag, breaking the page. The normal build process does not do that.

πŸŽ› Configuration (.babelrc, package.json, cli command)

No config.

Input HTML:

<html lang="en">
  <head>
    <meta charset="utf-8"/>
    <title>My First Parcel App</title>
    <script src="https://unpkg.com/petite-vue" defer init></script>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@shoelace-style/shoelace@2.15.0/cdn/themes/light.css" />
    <script type="module" src="https://cdn.jsdelivr.net/npm/@shoelace-style/shoelace@2.15.0/cdn/shoelace-autoloader.js"></script>

    <style>
        #graph {
          border: 1px solid #e0e0e0;
          width: 100%;
          height: 99%;
        }
      </style>
  </head>
  <body>
    <div v-scope="{ count: 0 }">
      {{ count }}
      <sl-button @click="count++">inc</sl-button>
    </div>
    <div id="graph"></div>
    <sl-drawer label="Drawer" class="drawer-overview">
      Lorem ipsum dolor sit amet, consectetur adipiscing elit.
      <sl-button slot="footer" variant="primary">Close</sl-button>
    </sl-drawer>
    
  </body>
</html>

πŸ€” Expected Behavior

Don't remove type=module

😯 Current Behavior

type=module is removed from the script tag in development server build only.

πŸ’ Possible Solution

πŸ”¦ Context

Can't leverage dev server

πŸ’» Code Sample

npx parcel --no-cache app/index.html

🌍 Your Environment

Mac OS

Software Version(s)
Parcel 2.12.0
Node v21.7.2
npm/Yarn npm
Operating System Mac OS

Further to this, parcel watch behaves the same way, breaking the app, while parcel build works correctly.