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.