sass: "~" import not resolved to parent node_modules
See original GitHub issueType of Issue
[x] Bug Report
[ ] Feature Request
Description
My library use the foundation sites dependency. When I install library as dependency in my main project, foundation sites dep has landed inside root node_modules instead of the library node_modules directory, so my sass import g.e. @import "~foundation-sites/scss/util/util";
not working. NPM > v2 has new installer which flat dependencies as maximally as possible.
BUILD ERROR
File to import not found or unreadable: /home/klimczakk/workspace/oauth-client/node_modules/ng-shared-module/node_modules/foundation-sites/scss/util/util.
Parent style sheet: /home/klimczakk/workspace/oauth-client/node_modules/ng-shared-module/src/core/components/sidebar/sidebar.component.scss
Error: File to import not found or unreadable: /home/klimczakk/workspace/oauth-client/node_modules/ng-shared-module/node_modules/foundation-sites/scss/util/util.
Parent style sheet: /home/klimczakk/workspace/oauth-client/node_modules/ng-shared-module/src/core/components/sidebar/sidebar.component.scss
at options.error (/home/klimczakk/workspace/oauth-client/node_modules/node-sass/lib/index.js:291:26)
How To Reproduce
Create app with library dependency, which has sass dependency (in my case foundation-sites) and not mentioned in app package.json. Next, import sass file from sass dependency any partial sass file with ~
and build in library postinstall hook.
Expected Behaviour
I think it’s a problem with https://www.npmjs.com/package/node-sass-tilde-importer which search nearest parent node_modules, so ng-packagr couldn’t found dep in root node_modules. Import with ~
could find module not only nearest node_modules.
Version Information
ng-packagr: 1.6.0
@angular/*: 5.0.0
typescript: 2.4.2
rxjs: 5.5.0
node: 8.9.1
npm/yarn: 5.5.1
foundation-sites: 5.4.1
Issue Analytics
- State:
- Created 6 years ago
- Reactions:2
- Comments:12 (3 by maintainers)
Top GitHub Comments
@dherges
i need your help plz, thx for ngpackagr is a amazing lib , but i have a problem
my config :
i use angular 4 an cli 1.6.5 src – app – assets – css _variables.scss
I use in my file angular-cli.json
so after that i can importe my file variable inside my component.scss.
in ng-package.json i add
"lib": { "entryFile": "public_api.ts", "styleIncludePaths": [ "./assets/css" ],
But when i try to npm run packagr i had this errror
File to import not found or unreadable: variables.
i don’t find a solution, you can help me plz plz ?
@dherges sorry to bug you, but is there a timeline for fixing this one? It’s blocking my team and I’d like to know if it makes sense to wait.