-
Notifications
You must be signed in to change notification settings - Fork 67
Description
Which version are you using (less-watch-compiler --version to find out)? 1.14.6
Is the issue reproducible after updating to the latest version ( npm update less-watch-compiler)? yes
Describe the bug
The LESS docs say that the .less extension is optional on imports.
But less-watch-compiler will throw an exception when it encounters such imports under very specific circumstances:
less-watch-compileris ran on watch mode- there's another file in a nested folder
To Reproduce
Steps to reproduce the behavior:
- My folder setup is
.
├── css
│ └── site.css
├── less
│ ├── bem
│ │ └── block
│ │ └── file.less
│ ├── color.less
│ └── site.less
The less/bem/block/file.less and less/color.less files are empty. The content of less/site.less is @import "color";.
- The command I ran is
yarn less-watch-compiler less css site.less - Something went wrong... What is it?
Actual behavior
less-watch-compiler throws an error:
~/s/repro (master|●7+2…) $
yarn less-watch-compiler less css site.less
yarn run v1.22.5
$ /home/filipesilva/sandbox/repro/node_modules/.bin/less-watch-compiler less css site.less
Watching directory for file changes.
internal/fs/utils.js:220
throw err;
^
Error: ENOENT: no such file or directory, stat '/home/filipesilva/sandbox/repro/less/color'
at Object.statSync (fs.js:915:3)
at Object.findLessImportsInFile (/home/filipesilva/sandbox/repro/node_modules/less-watch-compiler/dist/lib/filesearch.js:13:20)
at Object.fileWatcher (/home/filipesilva/sandbox/repro/node_modules/less-watch-compiler/dist/lib/lessWatchCompilerUtils.js:225:38)
at /home/filipesilva/sandbox/repro/node_modules/less-watch-compiler/dist/lib/lessWatchCompilerUtils.js:86:40
at /home/filipesilva/sandbox/repro/node_modules/less-watch-compiler/dist/lib/lessWatchCompilerUtils.js:67:27
at FSReqCallback.oncomplete (fs.js:159:5) {
errno: -2,
syscall: 'stat',
code: 'ENOENT',
path: '/home/filipesilva/sandbox/repro/less/color'
}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Expected behavior
Should compile less files successfully.
Desktop (please complete the following information):
- OS: Ubuntu 18.04.3 LTS
Additional context
Using the --run-once flag will make it compile sucessfully.
Using the @import "color.less"; will make it compile sucessfully.
Removing the less/bem/block folder and leaving behind an empty less/bem folder will also make it compile sucessfully.