Logic of "identing" is pretty straightforward - if ident is provided in options - that one is respected, but if there is no ident - it is generated based on index of rule in RuleSet
vue-loader heavily modifies rules afternormalizeRules kicked in and put ident's for existing rules here & there.
That means that templateLoader rule, will receive ident based on it's position in rules 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 idents
Since we're putting old rules lower than templateLoader - when resoving ident --> options we will receive wrong object
To fix this we will be reusing vueLoaderUse ident. This is 100% safe, since our rule after identing will be thrown away so no clash here possible. I was even able to test that :smile:
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 :smile:This should fix #2029