Skip to content

Commit

Permalink
Having inline and less imports of the same name lead to a race co…
Browse files Browse the repository at this point in the history
…ndition

Stumbled upon this working on webpack-contrib/less-loader#242.
See an instance of the mentioned race condition here: https://ci.appveyor.com/project/webpack-contrib/less-loader/build/1.0.46/job/mbywf90cimqkjee5

It happens when processing files like this:
```less
@import (less) "some/css.css";
@import (inline) "some/css.css";
```
  • Loading branch information
thorn0 authored Feb 19, 2018
1 parent 2f1386f commit 6985541
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/less/import-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,10 @@ module.exports = function(environment) {
callback(null, {rules:[]}, false, null);
}
else {
if (!importManager.files[fullPath]) {
// Inline imports aren't cached here.
// If we start to cache them, please make sure they won't conflict with non-inline imports of the
// same name as they used to do before this comment and the condition below have been added.
if (!importManager.files[fullPath] && !importOptions.inline) {
importManager.files[fullPath] = { root: root, options: importOptions };
}
if (e && !importManager.error) { importManager.error = e; }
Expand Down

0 comments on commit 6985541

Please sign in to comment.