Resolve accompanies to just the original import id #462
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Maybe I misunderstood how combining multiple main files worked, at least I could not make it work for our use-case.
I really love how the feature is used by just adding multiple Elm modules as query params, this makes it super flexible.
We have four different Elm apps which should be compiled into one bundle. There are four different JS modules that import the combined Elm apps individually. So
index-a.js
,index-b
and so on each importA.elm?with=B.elm&with=C.elm&with=D.elm
. This is simplified, as the JS and Elm entry points might live at different directory levels. It worked at some cases, but adding the fourth Elm module to the list made it break. I believe this was caused by setting a wrongimporter
when walking the import tree in the original implementation. I do not know a lot about Vite's or Rollup's internals, but it made me wonder if it is actually needed.In this PR I made it such that the path in each
with
param is relative to the originally required Elm module,A.elm
in this case. So in the implementation I use a simplepath.resolve
to add each accompany to the list of compilable Elm modules. It is much simpler and is something I can understand. But I also have a feeling I'm missing something in the original implementation.