You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{ Error: ENOENT: no such file or directory, open 'C:\C:\project\src\components\style.css'
at Error (antive)
error: -4058,
code: 'ENOENT',
syscall: 'open',
path: 'C:\C:\project\src\components\style.css'
}
I use "[email protected]".
The problem in file "node_modules/css-modules-loader-core/lib/file-system-loader.js" in the row number 64:
If "_this.root" equals to "/" and "relativeDir" equals to "C:\project\src\components\MyReactComponent" in function "_path2['default'].join(_this.root, relativeDir)" then result will be:
\C:\project\src\components\MyReactComponent
After that, if "newPath" equals to "../style.css", then in the function "_path2['default'].resolve('\C:\project\src\components\MyReactComponent', './style.css')" result will be:
C:\C:\project\src\components\style.css
And this is the error.
The problem is in the "_this.root", that is equal to "/".
"/" comes from the "root" - the argument of function "FileSystemLoader":
function FileSystemLoader(root, plugins) {
this.root = root;
...
...
var _this = this;
...
...
fileRelativePath = _path2['default'].resolve(_path2['default'].join(_this.root, relativeDir), newPath);
Package "[email protected]" use function "FileSystemLoader" form "[email protected]".
In this package in the file "node_module/postcss-modules/build/index.js" in rows 54-57 exists this code:
function getLoader(opts, plugins) {
const root = typeof opts.root === "undefined" ? "/" : opts.root;
return typeof opts.Loader === "function" ? new opts.Loader(root, plugins) : new _fileSystemLoader2.default(root, plugins);
}
In this code if "typeof opts.root === "undefined"" then "root" equalt to "/".
After that "/" goes to "new _fileSystemLoader2.default(root, plugins);".
_fileSystemLoader2 is imported "FileSystemLoader" form "[email protected]".
I propose to replace in file "node_modules/css-modules-loader-core/lib/file-system-loader.js" this row number 64:
{ Error: ENOENT: no such file or directory, open 'C:\C:\project\src\components\style.css'
at Error (antive)
error: -4058,
code: 'ENOENT',
syscall: 'open',
path: 'C:\C:\project\src\components\style.css'
}
I use "[email protected]".
The problem in file "node_modules/css-modules-loader-core/lib/file-system-loader.js" in the row number 64:
fileRelativePath = _path2['default'].resolve(_path2['default'].join(_this.root, relativeDir), newPath);
If "_this.root" equals to "/" and "relativeDir" equals to "C:\project\src\components\MyReactComponent" in function "_path2['default'].join(_this.root, relativeDir)" then result will be:
\C:\project\src\components\MyReactComponent
After that, if "newPath" equals to "../style.css", then in the function "_path2['default'].resolve('\C:\project\src\components\MyReactComponent', './style.css')" result will be:
C:\C:\project\src\components\style.css
And this is the error.
The problem is in the "_this.root", that is equal to "/".
"/" comes from the "root" - the argument of function "FileSystemLoader":
function FileSystemLoader(root, plugins) {
this.root = root;
...
...
var _this = this;
...
...
fileRelativePath = _path2['default'].resolve(_path2['default'].join(_this.root, relativeDir), newPath);
Package "[email protected]" use function "FileSystemLoader" form "[email protected]".
In this package in the file "node_module/postcss-modules/build/index.js" in rows 54-57 exists this code:
function getLoader(opts, plugins) {
const root = typeof opts.root === "undefined" ? "/" : opts.root;
return typeof opts.Loader === "function" ? new opts.Loader(root, plugins) : new _fileSystemLoader2.default(root, plugins);
}
In this code if "typeof opts.root === "undefined"" then "root" equalt to "/".
After that "/" goes to "new _fileSystemLoader2.default(root, plugins);".
_fileSystemLoader2 is imported "FileSystemLoader" form "[email protected]".
I propose to replace in file "node_modules/css-modules-loader-core/lib/file-system-loader.js" this row number 64:
fileRelativePath = _path2['default'].resolve(_path2['default'].join(_this.root, relativeDir), newPath);
to this code:
var fileRelativePath;
if (_this.root === '/') {
fileRelativePath = _path2['default'].resolve(relativeDir, newPath);
} else {
fileRelativePath = _path2['default'].resolve(_path2['default'].join(_this.root, relativeDir), newPath);
}
Perhaps this will fix the bug.
The text was updated successfully, but these errors were encountered: