maxmx / bootstrap-stylus

Port of Bootstrap to Stylus
MIT License
585 stars 113 forks source link

Error with Webpack Can't resolve '../fonts/glyphicons #129

Closed laggingreflex closed 7 years ago

laggingreflex commented 7 years ago

I'm trying to use this with Webpack. I looked at another webpack issue #122 but mine seems different.

I'm getting this error:

ERROR in ./~/css-loader?importLoaders=3!./~/postcss-loader!/~/namespace-css-module-loader!/~/stylus-loader!./src/client/app/template/header/style.styl
Module not found: Error: Can't resolve '../fonts/glyphicons-halflings-regular.eot' in 'C:\...\src\client\app\template\header'
 @ ./~/css-loader?importLoaders=3!./~/postcss-loader!/~/namespace-css-module-loader!/~/stylus-loader!./src/client/app/template/header/style.styl 6:5580-5632 6:5655-5707
 @ ./src/client/app/template/header/style.styl
 @ ./src/client/app/template/header/index.js
 @ ./src/client/index.js

The Can't resolve '../fonts/glyphicons-halflings-regular.eot' indicates that it's trying to load that font file, which actually resides in the node_modules/bootstrap-styl/fonts dir, but it's trying to resolve it from my app's templates dir.


I also notice that there's a variable

$icon-font-path ?=         "../fonts/"

and so I tried changing it before importing

$icon-font-path =         "bootstrap/fonts/"
@import bootstrap

but then the error becomes Can't resolve './bootstrap/fonts/glyphicons- -- it adds ./ meaning it's still looking relative to my app's templates dir.

laggingreflex commented 7 years ago

Ahh, this worked:

$icon-font-path =         "~bootstrap-styl/fonts/"
@import bootstrap
Vivek205 commented 7 years ago

hhjhj

italofantone commented 6 years ago

It is not a fixed folder, it enters node_modules and observes the real route. In my case it is:

//** Load fonts from this directory.
@icon-font-path:          "~bootstrap-sass/assets/fonts/bootstrap/";

This is done in the file variables.less

jo-soft commented 5 years ago

@italomoralesf i guess you mean $icon-font-path: "~bootstrap-sass/assets/fonts/bootstrap/" ?

dangxuanphuc commented 4 years ago

I followed the recommendation on #1119 and added resolve-url-loader and that helped in my case.

smshaheryar commented 4 years ago

hello, i am developing a website in react js but i am getting an error

./src/custom.scss (./node_modules/css-loader/dist/cjs.js??ref--6-oneOf-5-1!./node_modules/postcss-loader/src??postcss!./node_modules/resolve-url-loader??ref--6-oneOf-5-3!./node_modules/sass-loader/dist/cjs.js??ref--6-oneOf-5-4!./src/custom.scss) Module not found: Can't resolve 'bootstrap-style/fonts/glyphicons-halflings-regular.eot' in 'D:\work\frontend-joeyco\src'

can please anyone helpme thankyou in advance

DebugTheCode commented 3 years ago

@smshaheryar follow @jo-soft 's answer. This worked for me.