1.1.2 • Published 2 years ago

@webpackon/use-fonts v1.1.2

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

@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>;
  }
};
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'),
  });