@@ -2764,6 +2764,31 @@ describe ('API: Plugin Context', () => {
27642764 expect ( result ) . to . deep . equal ( { hello : true } ) ;
27652765 } ) ;
27662766
2767+ it ( 'should not override meta if not is provided' , async ( ) => {
2768+ fs . stub ( './src/subdep.js' , ( ) => `export default 789` ) ;
2769+ fs . stub ( './src/dep.js' , ( ) => `import './subdep'; export default 456` ) ;
2770+ fs . stub ( './src/main.js' , ( ) => `import './dep'; export default 123` ) ;
2771+
2772+ let result ;
2773+ let bundle = await nollup ( {
2774+ input : './src/main.js' ,
2775+ plugins : [ {
2776+ async resolveId ( id , parent ) {
2777+ if ( id . indexOf ( 'main' ) > - 1 ) {
2778+ let target = await this . resolve ( './dep.js' , path . resolve ( process . cwd ( ) , './src/main.js' ) ) ;
2779+ ( await this . load ( { ...target , meta : { hello : true } } ) ) ;
2780+ let modInfo = ( await this . load ( { ...target , meta : undefined } ) ) ;
2781+ result = modInfo . meta ;
2782+
2783+ }
2784+ }
2785+ } ]
2786+ } ) ;
2787+
2788+ await bundle . generate ( { format : 'esm' } ) ;
2789+ expect ( result ) . to . deep . equal ( { hello : true } ) ;
2790+ } ) ;
2791+
27672792 it ( 'should support meta via importedIdResolutions' , async ( ) => {
27682793 fs . stub ( './src/subdep.js' , ( ) => `export default 789` ) ;
27692794 fs . stub ( './src/dep.js' , ( ) => `import './subdep'; export default 456` ) ;
@@ -2928,7 +2953,7 @@ describe ('API: Plugin Context', () => {
29282953
29292954 const DYNAMIC_IMPORT_PROXY_PREFIX = '\0dynamic-import:' ;
29302955
2931- let bundle = await rollup ( {
2956+ let bundle = await nollup ( {
29322957 input : './src/main.js' ,
29332958 plugins : [ {
29342959 async resolveDynamicImport ( specifier , importer ) {
0 commit comments