@webpackon/use-fonts
v1.1.2
Published
Webpackon use fonts
Downloads
4
Maintainers
Readme
@webpackon/use-fonts
Adds loader for fonts.
Supported extensions:
- otf
- eot
- ttf
- woff
- woff2
Install
npm i @webpackon/use-fonts --save
yarn add @webpackon/use-fonts
API
const { useFonts } = require('@webpackon/use-fonts');
useFonts(params?: UseFontsParams)(config: WebpackConfig)
UseFontsParams
export type UseFontsParams = {
transpileModules?: string[];
loaderParams?: {
generator?: Record<string, any>;
}
};
loaderParams.generator - webpack option
transpileModules
useFonts({
transpileModules: ['my-package']
})
Example
Full examples are here
const path = require('path');
const { compose } = require('@webpackon/core');
const { useFonts } = require('@webpackon/use-fonts');
module.exports = (_, { mode }) =>
compose(
useFonts()
)({
target: 'web',
entry: path.resolve(__dirname, 'src', 'index.tsx'),
});