-
Notifications
You must be signed in to change notification settings - Fork 146
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
manually inject local micro package modules #483
Comments
@ Jaew00Shin I think it's because the same builder that's inspecting the @InjectableInit and thus attempting to resolve AppFactoryDevPackageModule is also the builder responsible for generating .module.dart asset, so from the builder's perspective that asset doesn't exist yet at this moment in the build cycle. My hunch comes from reproducing what you demonstrated above and then testing the theory by:
This copied version of the produced asset now lives outside of the build lifecycle and the builder is properly able to resolve and inspect it, and the build for $initModuleGetIt then successfully completes. There could be more nuance around the timing to this, as there's a couple builders involved in the production here, one of which produces an interim asset in the cache (https://github.com/Milad-Akarie/injectable/blob/2f3422bc5d0f35b9f08abbb7bce2388219df2603/injectable_generator/build.yaml#L5C1-L12C67). In the config for these builders we do notice the 2nd builder produces both .configure.dart and .module.dart – if you're gung ho on solving this you could probably write your own configuration for that set of outputs as two separate builders configurations and use
|
This might be another hacky approach you could try https://github.com/dart-lang/build/blob/master/docs/faq.md#how-can-i-adjust-builder-ordering |
The above one is working well.
AppFactoryCorePackageModule is external package from the other package.
AppFactoryCorePakcageModule is defined and is generated in app_factory_core.
But,
If I add local micro package AppFactoryDevPackageModule, FormatException occurs.
The document in pub.dev said that "it's also possible to include micro local or external modules manually by passing them to the externalPackageModules property inside of @injectableInit so they're initialized with the rest of the local dependencies."
But it doesn't work to manually pass local modules.
How can I add local modules to externalPackagesModule?
The text was updated successfully, but these errors were encountered: