@@ -112,13 +112,15 @@ function patchTypes(): Plugin {
112
112
* Runner chunk should only import local dependencies to stay lightweight
113
113
*/
114
114
function validateRunnerChunk ( this : PluginContext , chunk : RenderedChunk ) {
115
- for ( const id of chunk . imports ) {
115
+ for ( const [ id , bindings ] of Object . entries ( chunk . importedBindings ) ) {
116
116
if (
117
117
! id . startsWith ( './' ) &&
118
118
! id . startsWith ( '../' ) &&
119
119
! id . startsWith ( 'types.d' )
120
120
) {
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
+ )
122
124
process . exitCode = 1
123
125
}
124
126
}
@@ -129,7 +131,7 @@ function validateRunnerChunk(this: PluginContext, chunk: RenderedChunk) {
129
131
*/
130
132
function validateChunkImports ( this : PluginContext , chunk : RenderedChunk ) {
131
133
const deps = Object . keys ( pkg . dependencies )
132
- for ( const id of chunk . imports ) {
134
+ for ( const [ id , bindings ] of Object . entries ( chunk . importedBindings ) ) {
133
135
if (
134
136
! id . startsWith ( './' ) &&
135
137
! id . startsWith ( '../' ) &&
@@ -141,7 +143,9 @@ function validateChunkImports(this: PluginContext, chunk: RenderedChunk) {
141
143
) {
142
144
// If validation failed, only warn and set exit code 1 so that files
143
145
// 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
+ )
145
149
process . exitCode = 1
146
150
}
147
151
}
0 commit comments