Closed simonihmig closed 6 months ago
I haven't yet looked into adding tests for this. I guess for covering imports of non-JS files, including query params, we would need to add a simple webpack loader in a scenario test? Like on that returns the query as the generated module's export, so we can assert that the loader is correctly invoked and the query stuff works? Should that be a separate scenario? Or any other suggestions?
Btw, I worked on these changes as part of making https://github.com/simonihmig/ember-responsive-image/pull/442 work with ember-auto-import, and it seems this is indeed the final missing piece, as the things that worked under Embroider are now also passing (locally) under eai! :tada:
This is looking reasonable. For tests, I think you can extend these where we test allowAppImports in general.
Adding a loader would be OK, but it also might be enough to use built-in webpack features like Asset Modules.
Added tests, this should be good now for another review! @ef4 @mansona
With the new
allowAppImports
feature, apps can import resources that are handled with custom webpack loaders. Some can allow you to customize their behavior by passing query params, likeimport image from './images/image.jpg?size=1024
.This PR is fixing two related issues:
allowAppImports
glob like'images/**/*.jpg'
would also match for imports that include query params, by stripping the query part before trying to match the import to the globEAI_DISCOVERED_EXTERNALS
was not taking their possible existence into account correctly, leavingEAI_DISCOVERED_EXTERNALS
around in the final build.