@@ -84,7 +84,7 @@ class ProjectConfigReader {
8484 this . assertPluginProjectDoesNotLoadPlugins ( project , configPath ) ;
8585
8686 const localResources = await this . readProjectResources ( configPath , project ) ;
87- const pluginResources = await this . readPlugins ( project . plugins , root ) ;
87+ const pluginResources = await this . readPlugins ( project . plugins , configPath ) ;
8888
8989 const entities = mergeProjectAndPluginEntities (
9090 localResources . entities ,
@@ -193,9 +193,12 @@ class ProjectConfigReader {
193193
194194 private async readPluginConfig (
195195 plugin : PluginReference ,
196- hostRoot : string ,
196+ hostConfigPath : string ,
197197 ) : Promise < PluginConfigData > {
198- const pluginRoot = resolvePluginRoot ( plugin . source , hostRoot ) ;
198+ const pluginRoot = resolvePluginRoot (
199+ plugin . source ,
200+ dirname ( hostConfigPath ) ,
201+ ) ;
199202 const { configPath } = await this . findConfigOrThrow ( pluginRoot ) ;
200203
201204 const project = await this . readConfigFile ( configPath ) ;
@@ -228,21 +231,24 @@ class ProjectConfigReader {
228231
229232 private async readPlugins (
230233 plugins : PluginReference [ ] ,
231- projectRoot : string ,
234+ configPath : string ,
232235 ) : Promise < ProjectResources > {
233236 const entities : Entity [ ] = [ ] ;
234237 const functions : BackendFunction [ ] = [ ] ;
235238
236239 const entityNameByPluginNamespace = new Map < string , string > ( ) ;
237240
238241 for ( const plugin of plugins ) {
239- const { configPath, pluginNamespace, project } =
240- await this . readPluginConfig ( plugin , projectRoot ) ;
241- this . registerPluginNamespace ( pluginNamespace , configPath ) ;
242+ const {
243+ configPath : pluginConfigPath ,
244+ pluginNamespace,
245+ project,
246+ } = await this . readPluginConfig ( plugin , configPath ) ;
247+ this . registerPluginNamespace ( pluginNamespace , pluginConfigPath ) ;
242248
243249 const pluginData = await this . readPluginResources (
244250 project ,
245- configPath ,
251+ pluginConfigPath ,
246252 pluginNamespace ,
247253 ) ;
248254
@@ -253,7 +259,7 @@ class ProjectConfigReader {
253259 if ( existingPluginNamespace ) {
254260 throw new ConfigInvalidError (
255261 `Entity "${ entity . name } " is defined by more than one plugin: "${ existingPluginNamespace } " and "${ pluginNamespace } ".` ,
256- configPath ,
262+ pluginConfigPath ,
257263 {
258264 hints : [
259265 {
0 commit comments