Skip to content

Introduction

conventional-changelog-preset-loader resolves a preset by name — turning a shorthand like angular into the conventional-changelog-angular package — and loads its config. It’s what powers .loadPreset() across the tooling; reach for it directly when building your own tools or when a bundler needs a custom module loader.

  1. Install conventional-changelog-preset-loader:

    pnpm add conventional-changelog-preset-loader
  2. Load a preset by name. loadPreset is async and imports the matching package:

    import { loadPreset } from 'conventional-changelog-preset-loader'
    const preset = await loadPreset('conventionalcommits')
  3. Get its config — the object returned by the preset’s createPreset factory:

    console.log(Object.keys(preset))
    // → ['commits', 'parser', 'writer', 'whatBump']

A bare name is expanded to the conventional-changelog- package, falling back to the name as-is:

InputResolved (in order)
angularconventional-changelog-angular, then angular
@scope/foo@scope/conventional-changelog-foo, then @scope/foo
@conventional-changelog/presetused as-is
/abs/path/to/preset.jsused as-is

Pass an object with a name and the preset’s options — everything is forwarded to createPreset:

const preset = await loadPreset({
name: 'conventionalcommits',
preMajor: true
})

The default loadPreset imports modules with import(name). When you need different resolution — for example inside a bundle — build a loader with createPresetLoader:

import { createPresetLoader } from 'conventional-changelog-preset-loader'
const loadPreset = createPresetLoader(name => import(name))
const preset = await loadPreset('conventionalcommits')

This is also how conventional-changelog accepts a custom loader as the second argument to .loadPreset().