What happen in rebuilding when config file changed


using ember cli 3.17 dev a babel plugin for replace some ENV variable and config CONST https://github.com/houfeng0923/ember-cli-global-env

hi, i have a problem when developing an ember cli addon , like ember-cli-global-env.

now, it looks work well . then i want to increase development experience , i hope reload latest config when config/global-env.js or config/environment.js changed , but i have no idea to do, i can’t find any addon hook invoked in rebuilding .

usually , when environment.js changed in dev, watcher can print ‘file changed xxxxx’ , and rebuild, but latest config in environment not reload yet . how can resolve it ?

i want u a help or idea . thank u

I think you are having a problem with the caching in broccoli-babel-transpiler.

There is a way to tell it that your transformation depends on inputs other than the source code that’s being transpiled: https://github.com/babel/broccoli-babel-transpiler/tree/09506f3b7f31b194a79f3eb5f1a81d2ac0336f10#caching

If you generate a cacheKey based on the contents of the config file, that may solve the problem.

1 Like

thank you .

i have a check about cache . but i think it’s not the point .

in actual, ember-cli-global-env can work well , when env config update before restart ember s.

babel plugins for broccoli can cache it correctly i think , because the options is right:

and for hbs is :

My expect case is : change config/* file, and hot re-compile correctly. not restart ember s or ember build.

but i think the cacheKey() only execute once . ? so i have no idea .