fix: re-use ident of vue rule for template compiler, fixes #2029 #2030
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.
Webpack 4 uses
ident
query param underneath to storeoptions
objects passed to loaders, and relies on thisident
param to retrieveoptions
for correct loaders https://github.com/webpack/webpack/blob/v4.46.0/lib/RuleSet.js#L560-L566Logic of "identing" is pretty straightforward - if
ident
is provided inoptions
- that one is respected, but if there is noident
- it is generated based on index of rule in RuleSetvue-loader heavily modifies rules after
normalizeRules
kicked in and putident
's for existing rules here & there.That means that
templateLoader
rule, will receiveident
based on it's position inrules
array, but at this point this ident might be occupied by some other loader (and that loader will not be "re-indented" because logic there is to maintain existing identsSince we're putting old rules lower than
templateLoader
- when resovingident
-->options
we will receive wrong objectTo fix this we will be reusing
vueLoaderUse
ident. This is 100% safe, since our rule afteridenting
will be thrown away so no clash here possible. I was even able to test that 😄This should fix #2029