Webpackon use html
npm install @webpackon/use-html
Features:
- adds html template support (uses html-webpack-config).
- minification html for production
shell
npm i @webpackon/use-html --save
``shell
yarn add @webpackon/use-html
`API
`ts
const { useHtml } = require('@webpackon/use-html');useHtml(params: UseHtmlParams)(config: WebpackConfig)
`$3
`ts
export type UseHtmlParams = {
mode: 'development' | 'production';
title?: string;
templatePath?: string;
};
`- mode - webpack mode
- title - html title
- templatePath - path for html template
Example
Full examples are here`js
const path = require('path');const { compose } = require('@webpackon/core');
const { useHtml } = require('@webpackon/use-html');
module.exports = (_, { mode }) =>
compose(
useHtml({
mode,
templatePath: path.resolve(__dirname, 'public', 'index.html'),
}),
)({
target: 'web',
entry: path.resolve(__dirname, 'src', 'index.tsx'),
});
``