Skip to content

ContentLayer does not follow the path aliases defined in tsconfig.json #38

@zhutmost

Description

@zhutmost

Thanks for the developers' great work.

ContentLayer does NOT follow the path aliases defined in tsconfig.json. So I met such an error:

ConfigReadError ([repo_path]/contentlayer.config.ts): Error [ERR_MODULE_NOT_FOUND]: Cannot find package '@/util' imported from [repo_path]/.contentlayer/.cache/v0.5.0/compiled-contentlayer-config-J3VF3BP3.mjs

when I am trying to import some packages in contentlayer.config.ts, like this:

import { createTagCount, createSearchIndex } from '@/util/PostContentLayer'

My path aliases are defined in tsconfig.json:

    ...
    "paths": {
      "@/*": ["./src/*"],
      ...
    },

Here are some related issues:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions