# They are hydration markers
Written for
Svelte 5.17.3
These are markers used at runtime for the purposes of hydration. src
<!---->
<!--[-->
<!--]-->
<!---->
<!----> # How to remove
Sveltekit currently does not provide a native API to remove them. src.
A possible workaround is to run a postbuild script to remove them.
{
"scripts": {
"postbuild": "node removeComments.js"
}
} import { readdirSync, readFileSync, statSync, writeFileSync } from 'node:fs'
import { join } from 'node:path'
const outdir = '.svelte-kit'
const removeComments = (filePath) => {
let content = readFileSync(filePath, 'utf-8')
content = content.replace(/<!--.*?-->/gs, '')
writeFileSync(filePath, content, 'utf-8')
}
const processDir = (dirPath) => {
readdirSync(dirPath).forEach((file) => {
const fullPath = join(dirPath, file)
if (statSync(fullPath).isDirectory()) processDir(fullPath)
else if (fullPath.endsWith('.html')) removeComments(fullPath)
})
}
processDir(outdir)
console.log('Removed comments from HTML files.')# These options do not work
# preserveComment = false
This only refer to user comments.
# CSR = false
Setting export const csr = false no longer removes the comments. src.