File tree 2 files changed +20
-0
lines changed 2 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -50,6 +50,10 @@ function tryResolve(pkg, importer) {
50
50
return relative . resolve ( pkg , importer ) ;
51
51
} catch ( err ) {
52
52
if ( err . code === 'MODULE_NOT_FOUND' ) return null ;
53
+ if ( err . code === 'ERR_PACKAGE_PATH_NOT_EXPORTED' ) {
54
+ console . warn ( `WARNING: Could not read svelte config from ${ pkg } . Reason: ${ err . message } ` ) ;
55
+ return null ;
56
+ }
53
57
throw err ;
54
58
}
55
59
}
Original file line number Diff line number Diff line change @@ -33,6 +33,22 @@ describe('rollup-plugin-svelte', () => {
33
33
) ;
34
34
} ) ;
35
35
36
+ it ( 'ignores esm module not exporting package.json' , ( ) => {
37
+ const { resolveId } = plugin ( ) ;
38
+ assert . equal (
39
+ resolveId ( 'esm-module-without-svelte-config' , path . resolve ( 'test/foo/main.js' ) ) ,
40
+ null
41
+ ) ;
42
+ } ) ;
43
+
44
+ it ( 'resolves esm module exporting package.json' , ( ) => {
45
+ const { resolveId } = plugin ( ) ;
46
+ assert . equal (
47
+ resolveId ( 'esm-widget' , path . resolve ( 'test/foo/main.js' ) ) ,
48
+ path . resolve ( 'test/node_modules/esm-widget/src/Widget.html' )
49
+ ) ;
50
+ } ) ;
51
+
36
52
it ( 'ignores virtual modules' , ( ) => {
37
53
const { resolveId } = plugin ( ) ;
38
54
assert . equal (
You can’t perform that action at this time.
0 commit comments