OnsenUI / OnsenUI

Mobile app development framework and SDK using HTML5 and JavaScript. Create beautiful and performant cross-platform mobile apps. Based on Web Components, and provides bindings for Angular 1, 2, React and Vue.js.
https://onsen.io/
8.83k stars 1.01k forks source link

Can't resolve '../fonts/Material-Design-Iconic-Font.ttf' - error on first run #2273

Closed darkylmnx closed 6 years ago

darkylmnx commented 6 years ago
[Core]
    onsenui 2.2.8

[Framework]
    vue 2.5.2

[Framework binding]
    vue-onsenui 2.4.2

[Platform]
    Desktop - Windows 10

[Browser]
    Desktop - Chrome 55.0.2883.75

Encountered problem image

How to reproduce just do a vue init webpack your-project and install onsen via npm then import and run the project

badpunman commented 6 years ago

disable postcss from build.

frandiox commented 6 years ago

@darkylmnx You need to configure font loaders in Webpack. There are templates with this done for you: vue init OnsenUI/vue-cordova-webpack or vue init OnsenUI/vue-pwa-webpack. You can use one of them or just check how they are configured.

badpunman commented 6 years ago

@frandiox Actually the difference between these templates is not related to font loaders at all. I struggled trying to figure out what was different between vue-webpack and onsenui templates earlier. It boils down to PostCss being disabled in the onsenui templates. The PostCss breaks relative font imports in some way.

frandiox commented 6 years ago

@badpunman Oh, I see. Looks like they added Postcss loader in recent updates. I was confused with a different issue, I remember I had to add something like this to the templates to make the icons work on Cordova.

In any case, looks like a resolving issue. It's probably fixable by changing some configuration in postcss-loader...

darkylmnx commented 6 years ago

weird that postcss use is breaking this, how can i use postcss then if i need it ?

badpunman commented 6 years ago

Don't know.

Sass libraries I've used provide a way to declare a sass-variable for absolute font-paths before importing. Not a case here though.