UNPKG

cz-typography

Version:

Universal Czech typography fixer for JavaScript, React, Next.js, and any SSR framework. Non-breaking spaces after one-letter prepositions, units, dates, ordinals and more.

34 lines (32 loc) 1.03 kB
import { fileURLToPath } from 'url'; import { dirname, resolve } from 'path'; // src/next/index.js function withCzTypography(nextConfig = {}, loaderOptions = {}) { const { options, include, exclude = /node_modules/ } = loaderOptions; const here = dirname(fileURLToPath(import.meta.url)); const loaderPath = resolve(here, "./loader.cjs"); return { ...nextConfig, webpack(webpackConfig, context) { webpackConfig.module = webpackConfig.module || { rules: [] }; webpackConfig.module.rules = webpackConfig.module.rules || []; webpackConfig.module.rules.push({ test: include || /\.(jsx?|tsx?)$/, exclude, use: [ { loader: loaderPath, options: { options } } ] }); if (typeof nextConfig.webpack === "function") { return nextConfig.webpack(webpackConfig, context); } return webpackConfig; } }; } export { withCzTypography }; //# sourceMappingURL=index.mjs.map //# sourceMappingURL=index.mjs.map