When a backtick/grave accent is used in a component, and one uses generate: 'ssr', the output function breaks due to the render() method using backticks to allow for a multi-line string.
This also appears to fail with the HTML escaped representation of the grave (`) as svelte evaluates it back to a backtick.
Smallest failing example:
<code>
const url = `${protocol}://duckduckgo.com`
</code>
<!-- OR -->
<code>
const url = `${protocol}://duckduckgo.com`
</code>
Output:
MyComponent.render = function ( root, options ) {
root = root || {};
return `<code>const url = `\${protocol}://duckduckgo.com`</code>`;
};
I'm not sure how the generator determines to use template strings vs double-quotes, because it seems like it differs (unless I was looking at different functions at the time).
Workaround: "Escape" the backticks in the component html file.
Input:
<code>
const url = \`${protocol}://duckduckgo.com\`
</code>
Output:
MyComponent.render = function ( root, options ) {
root = root || {};
return `<code>const url = \`\${protocol}://duckduckgo.com\`</code>`;
};
When a backtick/grave accent is used in a component, and one uses
generate: 'ssr', the output function breaks due to therender()method using backticks to allow for a multi-line string.This also appears to fail with the HTML escaped representation of the grave (
`) as svelte evaluates it back to a backtick.Smallest failing example:
Output:
I'm not sure how the generator determines to use template strings vs double-quotes, because it seems like it differs (unless I was looking at different functions at the time).
Workaround: "Escape" the backticks in the component html file.
Input:
Output: