fix: avoid minimizing non-javascript inline scripts (#517)

fix #538
fix #540
pull/545/head
Fabian Winkler 3 years ago committed by GitHub
parent 9270477fa5
commit 779b78902f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -182,7 +182,10 @@ function renderHead(head: HeadConfig[]): Promise<string> {
head.map(async ([tag, attrs = {}, innerHTML = '']) => {
const openTag = `<${tag}${renderAttrs(attrs)}>`
if (tag !== 'link' && tag !== 'meta') {
if (tag === 'script') {
if (
tag === 'script' &&
(attrs.type === undefined || attrs.type.includes('javascript'))
) {
innerHTML = (
await transformWithEsbuild(innerHTML, 'inline-script.js', {
minify: true

Loading…
Cancel
Save