Skip to content

Commit db6337d

Browse files
committed
fix: head refactor
1 parent c4c7cdd commit db6337d

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

packages/create-react-app-server/src/helpers/createHtmlFile.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,12 @@ export default ({ head, html, templatePath, path }) => {
2121

2222
// update <head> if we have it
2323
if (head) {
24-
const [beforeClosingHead, closingHeadAndAfter] = updatedHtml.split(
25-
/(?=<\/head>)/
24+
const headTag = '<head>';
25+
const [beforeOpeningHead, afterOpeningHead] = updatedHtml.split(
26+
headTag
2627
);
2728

28-
updatedHtml = [beforeClosingHead, head, closingHeadAndAfter].join('');
29+
updatedHtml = [beforeOpeningHead, headTag, head, afterOpeningHead].join('');
2930
logger.debug(`${LOGGER_NAMESPACE}: updated html with head`);
3031
}
3132

0 commit comments

Comments
 (0)