Skip to content

contentlayer.config.ts should handle tsconfig paths #238

Description

@stefanprobst

using an absolute import defined via tsconfig.json#paths in contentlayer.config.ts currently throws a ConfigReadError

steps to reproduce:

  • git clone git@github.com:stefanprobst/issue-contentlayer-tsconfig-paths.git
  • cd issue-contentlayer-tsconfig-paths
  • npm i
  • npm run generate

Activity

  1. seancdavis commented on Jun 3, 2022

    @seancdavis
    Collaborator

    @stefanprobst Will you please share the details of your error?

  2. stefanprobst commented on Jun 7, 2022

    @stefanprobst
    ContributorAuthor

    the above steps will print:
    Screenshot_20220607_101451

  3. stefanprobst commented on Jun 12, 2022

    @stefanprobst
    ContributorAuthor

    i think what is happening is that esbuild knows how to resolve path aliases, but does not transform them (see evanw/esbuild#394). so when importing here this will then throw the ConfigError.

  4. schickling commented on Jul 5, 2022

    @schickling
    Collaborator

    Thanks a lot for opening this issue @stefanprobst. I agree with your assessment and would for now suggest to put this on hold until there's a clear direction in regards to evanw/esbuild#394. (In case the official stance of the esbuild maintainers turns out to be to use a plugin for this, we can consider following that advise.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions