Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

fix(html): error while removing vite-ignore attribute for inline script #19062

Merged
merged 3 commits into from
Dec 31, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/vite/src/node/server/middlewares/indexHtml.ts
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ const devHtmlHook: IndexHtmlTransformHook = async (
getScriptInfo(node)

if (isIgnored) {
removeViteIgnoreAttr(s, sourceCodeLocation!)
removeViteIgnoreAttr(s, node.sourceCodeLocation!)
} else if (src) {
const processedUrl = processNodeUrl(
src.value,
Expand Down
1 change: 1 addition & 0 deletions playground/html/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ <h1>Hello</h1>

<div>External path: <span class="external-path"></span></div>
<script type="module" src="/external-path.js" vite-ignore></script>
<script type="module" vite-ignore></script>
<link rel="stylesheet" href="/external-path.css" vite-ignore />
<div>
External path by rollupOptions.external (build only):
Expand Down
Loading