Skip to content

Commit 6985541

Browse files
authoredFeb 19, 2018
Having inline and less imports of the same name lead to a race condition
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"; ```
1 parent 2f1386f commit 6985541

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed
 

‎lib/less/import-manager.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,10 @@ module.exports = function(environment) {
5151
callback(null, {rules:[]}, false, null);
5252
}
5353
else {
54-
if (!importManager.files[fullPath]) {
54+
// Inline imports aren't cached here.
55+
// If we start to cache them, please make sure they won't conflict with non-inline imports of the
56+
// same name as they used to do before this comment and the condition below have been added.
57+
if (!importManager.files[fullPath] && !importOptions.inline) {
5558
importManager.files[fullPath] = { root: root, options: importOptions };
5659
}
5760
if (e && !importManager.error) { importManager.error = e; }

0 commit comments

Comments
 (0)
Please sign in to comment.