@@ -112,13 +112,15 @@ function patchTypes(): Plugin {
112112 * Runner chunk should only import local dependencies to stay lightweight
113113 */
114114function validateRunnerChunk ( this : PluginContext , chunk : RenderedChunk ) {
115- for ( const id of chunk . imports ) {
115+ for ( const [ id , bindings ] of Object . entries ( chunk . importedBindings ) ) {
116116 if (
117117 ! id . startsWith ( './' ) &&
118118 ! id . startsWith ( '../' ) &&
119119 ! id . startsWith ( 'types.d' )
120120 ) {
121- this . warn ( `${ chunk . fileName } imports "${ id } " which is not allowed` )
121+ this . warn (
122+ `${ chunk . fileName } imports "${ bindings . join ( ', ' ) } " from "${ id } " which is not allowed` ,
123+ )
122124 process . exitCode = 1
123125 }
124126 }
@@ -129,7 +131,7 @@ function validateRunnerChunk(this: PluginContext, chunk: RenderedChunk) {
129131 */
130132function validateChunkImports ( this : PluginContext , chunk : RenderedChunk ) {
131133 const deps = Object . keys ( pkg . dependencies )
132- for ( const id of chunk . imports ) {
134+ for ( const [ id , bindings ] of Object . entries ( chunk . importedBindings ) ) {
133135 if (
134136 ! id . startsWith ( './' ) &&
135137 ! id . startsWith ( '../' ) &&
@@ -141,7 +143,9 @@ function validateChunkImports(this: PluginContext, chunk: RenderedChunk) {
141143 ) {
142144 // If validation failed, only warn and set exit code 1 so that files
143145 // are written to disk for inspection, but the build will fail
144- this . warn ( `${ chunk . fileName } imports "${ id } " which is not allowed` )
146+ this . warn (
147+ `${ chunk . fileName } imports "${ bindings . join ( ', ' ) } " from "${ id } " which is not allowed` ,
148+ )
145149 process . exitCode = 1
146150 }
147151 }
0 commit comments