less.js
less.js copied to clipboard
Importing less files from a third party library crashes the build.
To reproduce:
- Create a new project folder.
- Run
npm init -y. - Install
lessandswiper. - Create a
main.lessfile in the root/src folder. - Create a build script that runs
lessc (src/)main.less output/styles.css.
Add these lines in the main.less file.
@import (less) 'swiper/less';
@import (less) 'swiper/less/navigation';
@import (less) 'swiper/less/pagination';
Current behavior: The build script fails with the following error.
FileError: 'swiper/less' wasn't found. Tried - path\swiper-package\swiper\less.less,path\swiper-package\swiper\less.less,npm://swiper\less,npm://swiper\less.less,swiper\less.less in path\swiper-package\main.less on line 1, column 1:
1 @import (less) 'swiper/less';
Expected behavior:
Should have outputted the CSS. Not sure if this is because swiper is using exports in their package.json file.
From reports I heard at work, this works fine on Mac.
Environment information:
lessversion: 4.1.3nodejsversion: 16.15.0operating system: Windows 10/11 x64
Sounds like it could be an issue with node_modules path resolving on Windows. Can you create an example repo?