diff --git a/src/compiler/preprocess/index.ts b/src/compiler/preprocess/index.ts index d90d4814d7..a9ba331e6d 100644 --- a/src/compiler/preprocess/index.ts +++ b/src/compiler/preprocess/index.ts @@ -95,7 +95,7 @@ export default async function preprocess( source = await replace_async( source, /|([^]*?)<\/script>|\/>)/gi, - async (match, attributes = '', content = '') => { + async (match, attributes = '', content) => { if (!attributes && !content) { return match; } @@ -115,7 +115,7 @@ export default async function preprocess( source = await replace_async( source, /|([^]*?)<\/style>|\/>)/gi, - async (match, attributes = '', content = '') => { + async (match, attributes = '', content) => { if (!attributes && !content) { return match; } diff --git a/test/preprocess/samples/script-self-closing/_config.js b/test/preprocess/samples/script-self-closing/_config.js index 4baab9730e..15d43ac432 100644 --- a/test/preprocess/samples/script-self-closing/_config.js +++ b/test/preprocess/samples/script-self-closing/_config.js @@ -3,7 +3,7 @@ import * as assert from "assert"; export default { preprocess: { script: ({ content, attributes }) => { - assert.equal(content, ""); + assert.equal(content, undefined); return { code: `console.log("${attributes["the-answer"]}");` }; diff --git a/test/preprocess/samples/style-self-closing/_config.js b/test/preprocess/samples/style-self-closing/_config.js index 0a05cd3d64..3c3ffabc26 100644 --- a/test/preprocess/samples/style-self-closing/_config.js +++ b/test/preprocess/samples/style-self-closing/_config.js @@ -3,7 +3,7 @@ import * as assert from "assert"; export default { preprocess: { style: ({ content, attributes: { color } }) => { - assert.equal(content, ""); + assert.equal(content, undefined); return { code: `div { color: ${color}; }` };