I need to get the font that is in ./src/assets/fonts and convert it to base64
my config-overrides.js
addWebpackModuleRule({
test: /\.ttf$/,
use: [
{
loader: 'ttf-loader',
options: {
name: './src/assets/fonts/[hash].[ext]'
}
}
]
}),
and the file itself, in which I import this font, where I already convert it to base64
import font from '../assets/fonts/font.ttf'
const someFun = () =>{
return btoa(font);
}
But I am getting error
Module parse failed: Unexpected token (4:7)
File was processed with these loaders:
* ./node_modules/ttf-loader/src/index.js
You may need an additional loader to handle the result of these loaders.
|
| module.exports = createFontFamily({
> ttf: export default __webpack_public_path__ +
"./src/assets/fonts/7233a7aee250f9b77fba5f735143ad39.ttf",
| woff: export default __webpack_public_path__ +
"./src/assets/fonts/f46b66ed2d54e5321411edfe916b7300.woff",
| });