Skip to content

test: css addWatchFile in load hook - #18103

Closed
bluwy wants to merge 1 commit into
mainfrom
css-load-dependencies
Closed

bluwy wants to merge 1 commit into
mainfrom
css-load-dependencies

Conversation

@bluwy

@bluwy bluwy commented Sep 13, 2024

Copy link
Copy Markdown
Member

Description

Adds a failing test for CSS that relies on the load hook and calls this.addWatchFile there, which doesn't work currently (in v6 only).

The reason is because of here:

private _updateModuleLoadAddedImports(
id: string,
addedImports: Set<string> | null,
): void {
const module = this.moduleGraph?.getModuleById(id)
if (module) {
this._moduleNodeToLoadAddedImports.set(module, addedImports)
}
}

The module does not exist until the load hook finishes here:

// ensure module in graph after successful load
mod ??= await moduleGraph._ensureEntryFromUrl(url, undefined, resolved)

I'm not entirely sure why it worked in v5 yet (for SPA only). But for SSR, I know that since the module nodes are shared, the pluginContainer can share the client module node after ssr already created the module node.

@bolt-new-by-stackblitz

Copy link
Copy Markdown

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@bluwy bluwy added the regression The issue only appears after a new release label Nov 25, 2024
@bluwy

bluwy commented Jul 12, 2026

Copy link
Copy Markdown
Member Author

Probably still an issue, but no one seems to have reported this so it's probably not important enough to fix this. Also, it's easier to track this in an issue.

@bluwy bluwy closed this Jul 12, 2026
@bluwy
bluwy deleted the css-load-dependencies branch July 12, 2026 17:30
jantimon added a commit to jantimon/vite-load-addwatchfile that referenced this pull request Oct 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

regression The issue only appears after a new release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant