Skip to content

Commit

Permalink
build: validate moduleRunnerTransport
Browse files Browse the repository at this point in the history
  • Loading branch information
sheremet-va committed Dec 9, 2024
1 parent ce3c10b commit 8d2d100
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/vite/rollup.dts.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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`)
Expand All @@ -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 + '/'))
) {
Expand Down

0 comments on commit 8d2d100

Please sign in to comment.