Webpackon use fonts
npm install @webpackon/use-fonts
Adds loader for fonts.
Supported extensions:
- otf
- eot
- ttf
- woff
- woff2
shell
npm i @webpackon/use-fonts --save
``shell
yarn add @webpackon/use-fonts
`API
`ts
const { useFonts } = require('@webpackon/use-fonts');useFonts(params?: UseFontsParams)(config: WebpackConfig)
`$3
`ts
export type UseFontsParams = {
transpileModules?: string[];
loaderParams?: {
generator?: Record;
}
};
`- loaderParams.generator - webpack option
- transpileModules
`ts
useFonts({
transpileModules: ['my-package']
})
`Example
Full examples are here`js
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'),
});
``