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
identquery param underneath to storeoptionsobjects passed to loaders, and relies on thisidentparam to retrieveoptionsfor correct loaders https://github.com/webpack/webpack/blob/v4.46.0/lib/RuleSet.js#L560-L566Logic of "identing" is pretty straightforward - if
identis 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
normalizeRuleskicked in and putident's for existing rules here & there.That means that
templateLoaderrule, will receiveidentbased on it's position inrulesarray, 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-->optionswe will receive wrong objectTo fix this we will be reusing
vueLoaderUseident. This is 100% safe, since our rule afteridentingwill be thrown away so no clash here possible. I was even able to test that 😄This should fix #2029