Skip to content

Scripts are not being injected into the html template. #11368

@jfrancis537

Description

@jfrancis537

Describe the bug

Adding a HTML comment to the <body> that contains a closing body tag

ex: <!-- </body> -->

Will prevent the main scripts from being injected.

I tried to reproduce this with a minimal webpack configuration to determine if the plugin behaved that way on it's own.
However I was not able to reproduce the bug that way. I expect the issue is somewhere in the webpack configuration.

The obvious workaround is to not include comment with the body tag, and that will work for me, I'm filing this bug so that others who encounter it can find the solution here.

Did you try recovering your dependencies?

This is a fresh project, so It is unlikely that this is the issue.

Which terms did you search for in User Guide?

Not Relevant

Environment

A fresh build using npx create-react-app my-app --template typescript was used.

Steps to reproduce

(Write your steps here:)

  1. Setup a new environment using the typescript template. npx create-react-app my-app --template typescript
  2. A a comment with a closing body tag to the body of the generate index.html template: <!-- </body> -->
  3. run npm run build
  4. Inspect the output index.html
  5. observe the scripts were not injected

Expected behavior

Html Comments should be ignored, and the scripts should be injected.

Actual behavior

The scripts are not injected into the template.

Reproducible demo

Given that this doesn't take much off the template to reproduce, I think this is unnecessary.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions