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

Local @font-face files not loading when using npm run start #691

Closed
nebulousGirl opened this issue Sep 11, 2019 · 12 comments
Closed

Local @font-face files not loading when using npm run start #691

nebulousGirl opened this issue Sep 11, 2019 · 12 comments
Labels
Type: Question Further information is requested

Comments

@nebulousGirl
Copy link

When loading font files directly from SCSS files, they do not load properly with npm run start, but work correctly when doing npm run build.

@nebulousGirl
Copy link
Author

I've found that publicPath is undefined in my webpack config rules generated by wpackio.

@nebulousGirl
Copy link
Author

[ { loader: 'file-loader', options: { name: '[name]-[hash:8].[ext]', outputPath: 'web/assets/', publicPath: undefined } } ]

@nebulousGirl
Copy link
Author

If I manually navigate to the file, it exists, but it doesn't load at all in the browser from the browserSync blob. I don't see the file in Network.

Sorry, for all those comments, I'm commenting as I debug and find new stuff.

@Deejay-Ste
Copy link

Hi, I have the same issue. Any ETA on this ?

@swashata
Copy link
Owner

Hi,

I will take a look.

@swashata swashata added Priority: High Type: Bug Something isn't working labels Oct 27, 2019
@swashata
Copy link
Owner

Hi,

Could you please give me a repo for reproduction? I have checked some asset files and they do seem to work.

swashata added a commit that referenced this issue Oct 28, 2019
@swashata
Copy link
Owner

I have checked with specific .woff files and they do work. Please share a repro repo so that I can look into it.

Also make sure you are on version 3.5.0 or greater.

@swashata swashata added Type: Question Further information is requested and removed Priority: High Type: Bug Something isn't working labels Oct 28, 2019
@Deejay-Ste
Copy link

Hi, I don't have time to make a repo for this but it's actually pretty simple to reproduce. You have to make a fresh WordPress install and apply the example theme of this repo (this one), then install npm and composer dependencies. After add some fonts in the assets directory and declare them in src/theme/main.scss. Then run npm run start and you'll end up with the Webpack dev server running but the fonts won't be loaded (as seen on the screenshot).
screenshot

@Deejay-Ste
Copy link

Deejay-Ste commented Oct 28, 2019

Although if you run npm run build they'll load correctly.
screenshot-2

@swashata
Copy link
Owner

Maybe it had something to do with style-loader. Please upgrade to v4.1.0. I have removed style loader in favor of HMR from mini-css-extract-plugin.

@Deejay-Ste
Copy link

Thanks, I tested the v4.1.0 and it works now. Like you said it might be because of style-loader. You can close this issue.

@swashata
Copy link
Owner

Great...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants