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

[css-loader] Problem with static files #1435

Closed
krasevych opened this issue Aug 21, 2017 · 8 comments
Closed

[css-loader] Problem with static files #1435

krasevych opened this issue Aug 21, 2017 · 8 comments

Comments

@krasevych
Copy link

krasevych commented Aug 21, 2017

Hi,
I have a code:

@font-face {
  font-family: icomoon;
  src: url('/fonts/icomoon/icomoon.woff2') format('woff2');

  font-weight: normal;
  font-style: normal;
}

After I updated Nuxt from 0.10.6 to rc5 I got an error:(before update it works)

 in ./node_modules/css-loader?{"minimize":true,"importLoaders":1,"sourceMap":true,"root":"~","alias":{"/static":"D://Projects//Vue//***//src//static","/assets":"D://Projects//Vue//***//src//assets"}}!./node_modules/postcss-loader/lib?{"sourceMap":true,"plugins":[null,null,{"version":"6.0.9","plugins":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null],"postcssPlugin":"postcss-cssnext","postcssVersion":"6.0.9"}]}!./node_modules/sass-loader/lib/loader.js?{"sourceMap":true}!./src/css/main.scss
Module not found: Error: Can't resolve 'fonts/icomoon/icomoon.woff2' in 'D:\Projects\Vue\Smart Landing\smart-landing-client\src\css'
 @ ./node_modules/css-loader?{"minimize":true,"importLoaders":1,"sourceMap":true,"root":"~","alias":{"/static":"D://Projects//Vue//***//src//static","/assets":"D://Projects//Vue//***//src//assets"}}!./node_modules/postcss-loader/lib?{"sourceMap":true,"plugins":[null,null,{"version":"6.0.9","plugins":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null],"postcssPlugin":"postcss-cssnext","postcssVersion":"6.0.9"}]}!./node_modules/sass-loader/lib/loader.js?{"sourceMap":true}!./src/css/main.scss 6:140737-140775
 @ ./src/css/main.scss
 @ ./node_modules/babel-loader/lib?{"presets":["vue-app","stage-0","es2015"],"plugins":["transform-decorators-legacy","transform-class-properties"],"babelrc":false,"cacheDirectory":true}!./node_modules/vue-loader/lib/selector.js?type=script&index=0!./.nuxt/App.vue
 @ ./.nuxt/App.vue
 @ ./.nuxt/index.js
 @ ./.nuxt/client.js
 @ multi webpack-hot-middleware/client?name=client&reload=true ./.nuxt/client.js
This bug report is available on Nuxt.js community (#c1277)
@pi0
Copy link
Member

pi0 commented Aug 21, 2017

Hi. This is because rc5 tries to correctly load and hash font assets. If not is inside assets, please use '~/assets/fonts/..` instead.

PS: Are you using custom postcss rules?

@krasevych
Copy link
Author

@pi0 thank you for your answer, but the fonts are placing in static/, and ~/static/fonts/.. doesn't work

@hendrysadrak
Copy link

Even if inside ~/assets it doesn't work if there is a space inside font file name (i.e. Averta Bold.otf)

@Atinux
Copy link
Member

Atinux commented Aug 22, 2017

Hi @krasevych

Indeed it's because of css-loaders aliases, I'm looking at it.

@Atinux
Copy link
Member

Atinux commented Aug 22, 2017

I updated the css-loader to handle aliases starting with /, let's hope it could be merged pretty fast!

See webpack-contrib/css-loader#597

@Atinux Atinux self-assigned this Aug 22, 2017
@Atinux Atinux changed the title problem with static files [css-loader] Problem with static files Aug 23, 2017
@fbrbovic
Copy link

Any update on this ? I have same problem and can't use rc5 now

@Atinux
Copy link
Member

Atinux commented Aug 29, 2017

Fixed with rc7, see #1453 (comment)

@lock
Copy link

lock bot commented Nov 3, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Nov 3, 2018
@danielroe danielroe added the 2.x label Jan 18, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants