Skip to content

Commit 7eb1dbd

Browse files
committed
fix: #564 resolves issue with element.replace on non-string elements
1 parent d51c300 commit 7eb1dbd

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/runtime/nitro/plugins/20-subresourceIntegrity.ts

+5
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ export default defineNitroPlugin((nitroApp) => {
2424
const sections = ['body', 'bodyAppend', 'bodyPrepend', 'head'] as Section[]
2525
for (const section of sections) {
2626
html[section] = html[section].map(element => {
27+
// Skip non-string elements
28+
if (typeof element !== 'string') {
29+
return element;
30+
}
31+
2732
element = element.replace(SCRIPT_RE, (match, rest: string, src: string) => {
2833
const hash = sriHashes[src]
2934
if (hash) {

0 commit comments

Comments
 (0)