Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dependency project path always points to src #13

Open
miekassu opened this issue Mar 31, 2022 · 5 comments
Open

dependency project path always points to src #13

miekassu opened this issue Mar 31, 2022 · 5 comments

Comments

@miekassu
Copy link

when projen generates paths to project tsconfig.ts it based speficied package dependencies, it always points path to src

like:

    "paths": {
      "@nordft/core-prismic": [
        "../../packages/core-prismic/src"
      ],
      "@nordft/core-ui": [
        "../../packages/core-ui/src"
      ]
    }

this throws an error:

Type error: File '/Users/kasperhamalainen/Code/nordft/nordft-monorepo/packages/core-ui/src/index.ts' is not under 'rootDir' '/Users/kasperhamalainen/Code/nordft/nordft-monorepo/apps/nordft-core-frontend'. 'rootDir' is expected to contain all source files.

instead of, this works:

    "paths": {
      "@nordft/core-prismic": [
        "../../packages/core-prismic/*"
      ],
      "@nordft/core-ui": [
        "../../packages/core-ui/*"
      ]
    }

l
ooks like projen generated ../src directory in path, no matter what would have been configured in dependency package tsconfig.ts, like outDit or rootDir.

any ideas?

@moltar
Copy link
Owner

moltar commented Apr 1, 2022

This package indeed hard-codes src as the dir where the source code lives. Because this is what is, I think, is also hard-coded in the projen TypeScript project type. But if you know of a way to get this value from the projen TypeScript type, we don't have to hard-code.

So your project does not put source files into the src/* dir, is that it?

@miekassu
Copy link
Author

miekassu commented Apr 2, 2022

yes, source files lives under src/*,
but build files are in different folder, for example in lib. This is defined in sub-project tsconfig.

I tested, defining lib path works:

    "paths": {
      "@nordft/core-prismic": [
        "../../packages/core-prismic/lib"
      ],
      "@nordft/core-ui": [
        "../../packages/core-ui/lib"
      ]
    }

so in this case, during build, parent project is looking for the sub-project build files, instead of source files.
why this, I'm not sure?

to specify, libraries are imported correctly, when I'm running project (nextjs) locally and dependencies are resolved in runtime. it only fails when I build.

@moltar
Copy link
Owner

moltar commented Apr 2, 2022

Could you please create a small repro project with a breakage?

You can use this demo to get started from to make it easier: https://github.com/moltar/projen-turborepo-test

@miekassu
Copy link
Author

miekassu commented Apr 2, 2022

here you go https://github.com/miekassu/projen-turborepo-test

  • run nextjs project locally, all good
  • build nextjs project, mentioned error
  • change sub-project dependency path to lib, no error, succesfull build

@moltar moltar closed this as completed in 130b79f Apr 25, 2022
@moltar
Copy link
Owner

moltar commented Apr 26, 2022

I don't think that fixed the issue :/

@moltar moltar reopened this Apr 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants