Configuration
next.config.js
const { default: classnamesMinifier } = require('@nimpl/classnames-minifier');
const { PHASE_PRODUCTION_SERVER, PHASE_DEVELOPMENT_SERVER } = require('next/constants');
module.exports = (phase) => classnamesMinifier({
prefix: '_',
reservedNames: ['_en', '_de'],
disabled: phase === PHASE_DEVELOPMENT_SERVER || phase === PHASE_PRODUCTION_SERVER,
})(nextConfig);
It is recommended to disable minification for development and for app startup after assembly - this way you will avoid unnecessary loads and possible cache deletions when starting the app.
Options
prefix
- custom prefix that will be added to each updated class;reservedNames
- array of reserved names that should not be used by this package (must include prefix);disabled
- disabling classnames minifying;disableDistDeletion
- option that allows you to disable the automatic deletion of the dist folder if necessary (f.e. differences in package setup in cache and now or first launch);