Support post loaders for template blocks #1500
Merged
+27
−1
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.
I know there is already a MR that sorts this issue out but I think bringing the
postLoader
option back is not the best approach to solve this issue. This merge request proposes a solution that allows post loaders to be applied after the template loader with no extra options.Motivation
In our project we would like to be able to execute a custom
babel-macro
in our templates and that requires us to process the compiled template using babel. Currently the v15 does not allow this. See: #1309.Description
The solution implemented in this merge request detects which loaders have
enforce: 'post'
option looking at thepitchExecuted
flag in the loader object. Once theVueLoaderPlugin
injects the pitcher at the beginning of the loaders list that means the pitcher'spitch
would be executed first than any loader. So, every loader which haspitchExecuted
equalstrue
would be a post loader. In that way we can inject the template loader between the post loaders and the rest of them.Fixes #1309.