-  
-   Notifications  You must be signed in to change notification settings 
- Fork 19
Open
Labels
bugSomething isn't workingSomething isn't working
Description
parseResource always marks all scripts as modules: 
vue-bundle-renderer/src/utils.ts
Lines 52 to 63 in 2016345
| export const parseResource = (path: string) => { | |
| const chunk: Omit<ResourceMeta, 'file'> = {} | |
| const extension = path.replace(/\?.*/, '').split('.').pop() || '' | |
| const asType = getAsType(extension) | |
| if (asType) { | |
| chunk.resourceType = asType | |
| if (asType === 'script') { | |
| chunk.module = true | |
| } | 
This in turn affects normalizeViteManifest which emits all script chunks as having module: true: 
vue-bundle-renderer/src/vite.ts
Lines 5 to 10 in 2016345
| export function normalizeViteManifest (manifest: ViteManifest | Manifest): Manifest { | |
| const _manifest: Manifest = {} | |
| for (const file in manifest) { | |
| const chunk = manifest[file] | |
| _manifest[file] = { ...parseResource(chunk.file || file), ...chunk } | 
Then, renderScripts always emits <script type="module"> preventing legacy browsers from even loading the code: 
vue-bundle-renderer/src/runtime.ts
Lines 234 to 237 in 253407e
| export function renderScripts (ssrContext: SSRContext, rendererContext: RendererContext): string { | |
| const { scripts } = getRequestDependencies(ssrContext, rendererContext) | |
| return Object.values(scripts).map(resource => renderScriptToString({ | |
| type: resource.module ? 'module' : null, | 
See nuxt/bridge#621 for the actual user-facing issue.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working