Skip to content

Commit 00fa3ab

Browse files
authored
fix(server-bundle): keep the with key on externalized icon JSON imports (#523)
1 parent 598d438 commit 00fa3ab

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

src/module.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,14 @@ export default defineNuxtModule<ModuleOptions>({
156156
return { id, external: true }
157157
}
158158
},
159+
// Rollup 4 re-prints the import attributes of external modules with the `assert`
160+
// key (`output.importAttributesKey`, switching to `with` only in Rollup 5), and
161+
// Node.js removed `assert` in v22 — the icon API then fails at runtime with
162+
// `ERR_IMPORT_ATTRIBUTE_MISSING`. Keep the key the generated code already uses.
163+
outputOptions(options: { importAttributesKey?: 'assert' | 'with' }) {
164+
options.importAttributesKey ||= 'with'
165+
return options
166+
},
159167
})
160168
})
161169

0 commit comments

Comments
 (0)