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

Font file not found #27

Open
dheeraja00 opened this issue Nov 16, 2016 · 1 comment
Open

Font file not found #27

dheeraja00 opened this issue Nov 16, 2016 · 1 comment

Comments

@dheeraja00
Copy link

I have defined my output in webpack config as:

output: {
		path: __dirname + '/dist'
	},

so all font files are also going in there, but when I execute my index.html it says ERR_FILE_NOT_FOUND

Not: Running without webpack-dev-derver, using this in chrome extension

@VernonGrant
Copy link

@dheeraja00 I was facing the same problem today. You can use the publicPath option of the file-loader module. I also ended up removing the url-loader from my webpack.config.js

A Simple Example

So imagine you want all your font files to be in the following location assets/fonts/ and your webpack config's main output path is set to assets/js/. We can then use the file-loader to emit all font files to our desired location using the outputPath option... this path is relative to your main output path.

You also have to set the publicPath option. This is the path relative to your index file so you won't end up with 404 errors. You can read more about the available file-loader option here.

module: {
        /* take a look at the publicPath option... */
        rules: [{
            test: /\.(eot|svg|ttf|woff|woff2)$/,
            use: [
                { loader: 'file-loader?name=[name].[ext]&outputPath=../fonts/&publicPath=/assets/fonts/'}
            ]}
        ]
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants