Skip to content

Commit

Permalink
fix: avoid minimizing non-javascript inline scripts (#517)
Browse files Browse the repository at this point in the history
fix #538
fix #540
  • Loading branch information
wynksaiddestroy committed Feb 22, 2022
1 parent 9270477 commit 779b789
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/node/build/render.ts
Expand Up @@ -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
Expand Down

0 comments on commit 779b789

Please sign in to comment.