Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Importing less files from a third party library crashes the build. #3750

Open
florinpavel22 opened this issue Sep 14, 2022 · 1 comment
Open
Labels

Comments

@florinpavel22
Copy link

florinpavel22 commented Sep 14, 2022

To reproduce:

  1. Create a new project folder.
  2. Run npm init -y.
  3. Install less and swiper.
  4. Create a main.less file in the root/src folder.
  5. 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:

  • less version: 4.1.3
  • nodejs version: 16.15.0
  • operating system: Windows 10/11 x64
@florinpavel22 florinpavel22 changed the title Importing less files from a package doesn't work. Importing less files from a third party library doesn't work. Sep 14, 2022
@florinpavel22 florinpavel22 changed the title Importing less files from a third party library doesn't work. Importing less files from a third party library crashes the build. Sep 14, 2022
@matthew-dean
Copy link
Member

Sounds like it could be an issue with node_modules path resolving on Windows. Can you create an example repo?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants