vercel / vercel/ncc

build fails with 0.18.5 (worked in 0.17.4)

Open
#382 8 comments 0 reactions 1 assignee View on GitHub

@guybedford is already working on this.

Since May 21, 2019.

bug priority
Dominant language
JavaScript
Stars
9.8k
Forks
326
PR merge metrics
No merged PRs in 30d

Description

First, a related question that could help me: Where is the documentation for ncc?
The readme file leaves many open question (at least for me as a beginner). And due to this lack of documentation I don't even know how ncc is supposed to work or which questions to ask. So I'm afraid, I must explain the whole use-case.

The build on our CI server was still okay with version 0.17.4 - but now fails with 0.18.5.
To me it seems, that ncc is now somehow finding our top-level tsconfig.json file and it tries to build the whole source code - which will not work, because we have a mono-repo and thus have many different tsconfig.json files.

This is how our code is organized:

  • tsconfig.json - top level ts config
  • angular.json
  • .. other files
  • apps dir
    • client
      • tsconfig.app.json
      • tsconfig.json
      • tsconfig.spec.json
    • server
      • tsconfig.json
    • ...
  • libs dir
    • shared
    • ...
  • node_modules dir
  • dist dir
    • apps
      • server
        • main.js - created by the prod build
        • tsconfig-json - created by our ci-script for ncc - content from your readme file

The ci script will first do a regular ng build of the server app which creates dist/apps/server/main.js. Then the ci script will cd to apps/server/ and execute ncc build main.js --minify --out ncc to build ncc/index.js.
It seems that the newer ncc version will traverse the folder tree up, find the top-level tsconfig.json file and then tries to compile all source code: e.g. in apps/client/... - which will fail, because the top-level tsconfig.json file is not suitable for that source code.

As a workaround I tried to delete the top-level tsconfig.json file - then the build works.

Questions:

  1. Why would ncc even try to start the typescript compiler? it already gets the main.js file?
  2. Why would it use the top-level tsconfig.json, when there is a tsconfig.json file in the current directory?
  3. Can I somehow configure which tsconfig.json file it should use?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.