Import less file from node_modules in angular library is not working
Bug Report or Feature Request (mark with an x)
- [x] bug report -> please search issues before submitting
- [ ] feature request
Command (mark with an x)
- [ ] new
- [x] build
- [x] serve
- [x] test
- [ ] e2e
- [ ] generate
- [ ] add
- [ ] update
- [ ] lint
- [ ] xi18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc
Versions
npm 6.3.0 node 10.8.0 angular-cli: 6.1.2 windows 7
Repro steps
- create new project: ng new my-app
- go into dir: cd my-app
- generate library: ng generate library my-lib
- create a component in my-lib with less stylesheet (my-lib.component.less).
- import some less file from npm in my-lib.component.less: @import (reference) "~some-module/path/to/file.less"; ...
- build library with: ng build my-lib
The log given by the failure
BUILD ERROR '~some-module/path/to/file.less' wasn't found. Tried ...
Desired functionality
importing some third party styles should work. It seems that ng-packagr adds also the prefix ~ or npm:// to this import.
Mention any other details that might be useful
if i remove the ~ from the import statement, ng build my-lib works as expected. But ng test my-lib doesn't work anymore, because ng test my-lib needs the ~ in the import statement.
ng-packagr only support relative ~ import syntax for SCSS files.
https://github.com/dherges/ng-packagr/issues/827 https://github.com/dherges/ng-packagr/issues/227
Closing as answered by @alan-agius4, cheers!
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.