UNPKG

@blunck/next-html

Version:

Import `.html` files as strings in your Next.js project

25 lines (20 loc) 649 B
const defaultHtmlLoaderOptions = { minimize: true, conservativeCollapse: false } module.exports = htmlLoaderOptions => (nextConfig = {}) => { htmlLoaderOptions = htmlLoaderOptions || defaultHtmlLoaderOptions return Object.assign({}, nextConfig, { webpack(config, options) { config.module.rules.push({ test: /\.html$/, loader: 'html-loader', options: htmlLoaderOptions }) if (typeof nextConfig.webpack === 'function') { return nextConfig.webpack(config, options) } return config } }) }