From 8d2d100e19ae239d34090ffca09d46dda9aa4df5 Mon Sep 17 00:00:00 2001 From: Vladimir Sheremet Date: Mon, 9 Dec 2024 16:35:47 +0100 Subject: [PATCH] build: validate moduleRunnerTransport --- packages/vite/rollup.dts.config.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/vite/rollup.dts.config.ts b/packages/vite/rollup.dts.config.ts index e622053ba156ba..edb10d020e4615 100644 --- a/packages/vite/rollup.dts.config.ts +++ b/packages/vite/rollup.dts.config.ts @@ -94,6 +94,8 @@ function patchTypes(): Plugin { renderChunk(code, chunk) { if ( chunk.fileName.startsWith('module-runner') || + // index and moduleRunner have a common chunk "moduleRunnerTransport" + chunk.fileName.startsWith('moduleRunnerTransport') || chunk.fileName.startsWith('types.d-') ) { validateRunnerChunk.call(this, chunk) @@ -116,6 +118,8 @@ function validateRunnerChunk(this: PluginContext, chunk: RenderedChunk) { if ( !id.startsWith('./') && !id.startsWith('../') && + // index and moduleRunner have a common chunk "moduleRunnerTransport" + !id.startsWith('moduleRunnerTransport.d') && !id.startsWith('types.d') ) { this.warn(`${chunk.fileName} imports "${id}" which is not allowed`) @@ -136,6 +140,8 @@ function validateChunkImports(this: PluginContext, chunk: RenderedChunk) { !id.startsWith('node:') && !id.startsWith('types.d') && !id.startsWith('vite/') && + // index and moduleRunner have a common chunk "moduleRunnerTransport" + !id.startsWith('moduleRunnerTransport.d') && !deps.includes(id) && !deps.some((name) => id.startsWith(name + '/')) ) {