Skip to content

Commit c273ae3

Browse files
authored
Merge pull request #14 from preactjs/fix/prerender-detection
chore: Sync new prerenderr script detection method & fix early return…
2 parents 4a4806d + af6902c commit c273ae3

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/index.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,14 +146,18 @@ async function scaffold(to, opts) {
146146
to,
147147
opts.useTS,
148148
);
149+
150+
const htmlPath = resolve(to, 'index.html');
151+
const html = (await fs.readFile(htmlPath, 'utf-8')).replace('<script', '<script prerender');
152+
await fs.writeFile(htmlPath, html);
149153
}
150154

151155
if (opts.useTS) {
152156
await fs.rename(resolve(to, 'jsconfig.json'), resolve(to, 'tsconfig.json'));
153157

154158
const htmlPath = resolve(to, 'index.html');
155159
const html = (await fs.readFile(htmlPath, 'utf-8')).replace('index.jsx', 'index.tsx');
156-
return await fs.writeFile(htmlPath, html);
160+
await fs.writeFile(htmlPath, html);
157161
}
158162

159163
if (opts.useESLint) {

0 commit comments

Comments
 (0)