I'm developing a React.js based chrome extension where all assets are bundled with webpack. On development (with webpack-dev-server
), I successfully managed to have Chrome load .woff
files from localhost:3000
. This is part of the loaders of my development webpack config:
{
test: /\.css$/,
include: /node_modules/,
loaders: ['style-loader', 'css-loader'],
},
{
test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/,
loader: 'url-loader?limit=10000&mimetype=application/font-woff'
},
{
test: /\.(ttf|eot|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
loader: 'file-loader'
}
The chrome extension for development has the following privileges (among others):
font-src 'self' http://localhost:3000 https://localhost:3000;
This works fine, I can use react-fa to use font-awesome like so:
<Icon name="eye" size="2x" />
However, as soon as I stop using webpack-dev-server, and build to an actual bundle to be imported as a Google chrome extension (with the same loaders), I start seeing the following errors in my console:
GET chrome-extension://jboakcijpodokbkfeooiffmbbmlfobnl/926c93d201fe51c8f351e858468980c3.woff2 net::ERR_FILE_NOT_FOUND
?brudy:1
GET chrome-extension://jboakcijpodokbkfeooiffmbbmlfobnl/891e3f340c1126b4c7c142e5f6e86816.woff net::ERR_FILE_NOT_FOUND
?brudy:1
GET chrome-extension://jboakcijpodokbkfeooiffmbbmlfobnl/fb650aaf10736ffb9c4173079616bf01.ttf net::ERR_FILE_NOT_FOUND
My chrome extension's manifest permissions are set appropriately, I believe:
font-src 'self';
But for some reason the .woff2
file does not seem to be within the bundle, at least not at that address. I checked the bundle/build folder and found the file at /build/js/926c93d201fe51c8f351e858468980c3.woff2
.
How would I make sure that the file is indeed accessible at the address chrome-extension://jboakcijpodokbkfeooiffmbbmlfobnl/926c93d201fe51c8f351e858468980c3.woff2
?