Not able to include less file from node_modules
See original GitHub issueMaybe I’m doing something wrong, but I can’t include a less file from my node_modules folder.
I took a clean install of Laravel 5.4. Next I did:
npm install
npm install bootstrap
- Create file
resources/assets/less/app.less
- Added content:
@import "node_modules/bootstrap/less/bootstrap";
- Changed
webpack.mix.js
file to:
mix.js('resources/assets/js/app.js', 'public/js')
.less('resources/assets/less/app.less', 'public/css');
- Run
npm run dev
This gives me this error: Module build failed: Can't resolve './node_modules/bootstrap/less/bootstrap.less'
When I install Laravel Elixir and try the same less file, it works perfectly… Hope someone can help. Thanks a lot!
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Relative path of node_modules for LESS @import
Is there no short hand notation so that the path is relative to project folder? Something like @import ~/node_modules/some-module/style.less ?
Read more >[Bug] Unable to import LESS files from node_modules via '~'
I am not following what the problem is here, the output of ng-packagr can be used in an Angular CLI project irrespective of...
Read more >global css cannot be imported from within node_modules.
Global CSS cannot be imported from within node_modules. #6 - GitHub ; import the .less files in your pages/_app instead of importing a...
Read more >node_modules/less-loader · master - GitLab an der TU Chemnitz
less -loader applies a Less plugin that passes all queries to the webpack resolver if less could not resolve @import . Thus you...
Read more >Dependency resolution - Parcel
npm : – a way for URL dependencies (e.g. in HTML, CSS, or web workers) to import files from a node_modules package. http:...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yeah it’s a less-loader thing. They’ve had an issue up for a year now about this.
The workaround is to use a tilda, like this:
Try
@import "../../../node_modules/bootstrap/less/bootstrap";