I execute npm run build, and the module scripts I expect in dist/index.html are not present in the code for this file, but rather the scripts are injected into the comment. View dist/index.html for confirmation.
Run npm install, npm run build and npm run dev (this may be done automatically for you if you use stackblitz).
System Info
.
Used Package Manager
npm
Logs
I have seen varients depending on system. In the provided link I saw
Error: createRoot(...): Target container is not a DOM element.
On my local:
Error: @vitejs/plugin-react can't detect preamble. Something is wrong. See https://github.com/vitejs/vite-plugin-react/pull/11#discussion_r430879201.
[X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
[X] Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to vuejs/core instead.
Describe the bug
To keep it simple, my
index.html
has a commented version of the code preceeding the code. E.g.I execute
npm run build
, and the module scripts I expect indist/index.html
are not present in the code for this file, but rather the scripts are injected into the comment. Viewdist/index.html
for confirmation.Reproduction
https://stackblitz.com/edit/vitejs-vite-fly8vq?file=index.html
Steps to reproduce
Run
npm install
,npm run build
andnpm run dev
(this may be done automatically for you if you use stackblitz).System Info
Used Package Manager
npm
Logs
I have seen varients depending on system. In the provided link I saw
Error: createRoot(...): Target container is not a DOM element.
On my local:Error: @vitejs/plugin-react can't detect preamble. Something is wrong. See https://github.com/vitejs/vite-plugin-react/pull/11#discussion_r430879201.
Validations