@@ -27,7 +27,6 @@ export function svelte(inlineOptions?: Partial<Options>): Plugin {
27
27
}
28
28
validateInlineOptions ( inlineOptions ) ;
29
29
const cache = new VitePluginSvelteCache ( ) ;
30
- const pkg_resolve_errors = new Set ( ) ;
31
30
// updated in configResolved hook
32
31
let requestParser : IdParser ;
33
32
let options : ResolvedOptions ;
@@ -136,14 +135,10 @@ export function svelte(inlineOptions?: Partial<Options>): Plugin {
136
135
return resolvedSvelteSSR ;
137
136
}
138
137
139
- try {
140
- const resolved = resolveViaPackageJsonSvelte ( importee , importer , cache ) ;
141
- if ( resolved ) {
142
- log . debug ( `resolveId resolved ${ resolved } via package.json svelte field of ${ importee } ` ) ;
143
- return resolved ;
144
- }
145
- } catch ( err ) {
146
- pkg_resolve_errors . add ( importee ) ;
138
+ const resolved = resolveViaPackageJsonSvelte ( importee , importer , cache ) ;
139
+ if ( resolved ) {
140
+ log . debug ( `resolveId resolved ${ resolved } via package.json svelte field of ${ importee } ` ) ;
141
+ return resolved ;
147
142
}
148
143
} ,
149
144
@@ -191,20 +186,6 @@ export function svelte(inlineOptions?: Partial<Options>): Plugin {
191
186
if ( svelteRequest ) {
192
187
return handleHotUpdate ( compileSvelte , ctx , svelteRequest , cache , options ) ;
193
188
}
194
- } ,
195
-
196
- /**
197
- * All resolutions done; display warnings wrt `package.json` access.
198
- */
199
- // TODO generateBundle isn't called by vite, is buildEnd enough or should it be logged once per violation in resolve
200
- buildEnd ( ) {
201
- if ( pkg_resolve_errors . size > 0 ) {
202
- log . warn (
203
- `vite-plugin-svelte was unable to find package.json of the following packages and wasn't able to resolve via their "svelte" field.
204
- If you had difficulties importing svelte components from a package, then please contact the author and ask them to export the package.json file.
205
- ${ Array . from ( pkg_resolve_errors , ( s ) => `- ${ s } ` ) . join ( '\n' ) } ` . replace ( / \t / g, '' )
206
- ) ;
207
- }
208
189
}
209
190
} ;
210
191
}
0 commit comments