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

@nx/angular:webpack-browser: Unable to locate tsconfig.generated.json #19807

Closed
3 of 4 tasks
arvindnama opened this issue Oct 23, 2023 · 1 comment · Fixed by #19843
Closed
3 of 4 tasks

@nx/angular:webpack-browser: Unable to locate tsconfig.generated.json #19807

arvindnama opened this issue Oct 23, 2023 · 1 comment · Fixed by #19843
Assignees
Labels
outdated scope: angular Issues related to Angular support in Nx type: bug

Comments

@arvindnama
Copy link

arvindnama commented Oct 23, 2023

Current Behavior

Project built using @nx/angular:webpack-browser builder and

  1. buildLibsFromSource set to false
  2. have a custom webpack.

Build fails with error

>  NX   Unable to load /Users/arvindnama/repos/app-1/Users/arvindnama/repos/app-1/tmp/apps/app-1/tsconfig.generated.json: ENOENT: no such file or directory, stat '/Users/arvindnama/repos/app-1/Users/arvindnama/repos/app-1/tmp/apps/app-1i/tsconfig.generated.json'

Expected Behavior

Should be able to resolve the generated tsconfig and build the application

GitHub Repo

No response

Steps to Reproduce

  1. mono repo with one app with custom webpack & atleast one buildable library that it depends on
  2. app uses @nx/angular:webpack-browser with
    a. buildLibsFromSource set to false
    b. have a custom webpack. ( just empty custom webpack config file will also suffice)

cmd:

npx nx run build --project=<app-name> 

sample project.json of the application

{
    "name": "app-1",
    "$schema": "../../node_modules/nx/schemas/project-schema.json",
    "sourceRoot": "apps/app-1/src",
    "projectType": "application",
    "targets": {
        "build": {
            "executor": "@nx/angular:webpack-browser",
            "options": {
                "customWebpackConfig": {
                    "path": "apps/app-1/webpack.config.js"
                },
                "outputPath": "dist/apps/app-1",
                "index": "apps/app-1/src/index.html",
                "main": "apps/app-1/src/main.ts",
                "tsConfig": "apps/app-1/src/tsconfig.app.json",
                "preserveSymlinks": true,
                "polyfills": ["apps/app-1/src/polyfills.ts"],
                "buildLibsFromSource": false,
                
          }
   }
}

Nx Report

>  NX   Report complete - copy this into the issue template

   Node   : 18.16.0
   OS     : darwin-arm64
   npm    : 9.5.1

   nx                 : 17.0.1
   @nx/js             : 17.0.1
   @nx/jest           : 17.0.1
   @nx/linter         : 17.0.1
   @nx/eslint         : 17.0.1
   @nx/workspace      : 17.0.1
   @nx/angular        : 17.0.1
   @nx/cypress        : 17.0.1
   @nx/devkit         : 17.0.1
   @nx/eslint-plugin  : 17.0.1
   @nx/plugin         : 17.0.1
   @nx/storybook      : 17.0.1
   @nrwl/tao          : 17.0.1
   @nx/web            : 17.0.1
   @nx/webpack        : 17.0.1
   typescript         : 4.9.5
   ---------------------------------------
   Community plugins:
   @storybook/angular : 6.5.15
   apollo-angular     : 4.2.1
   ---------------------------------------
   Local workspace plugins:
   	 @***/tools/migration
   	 @**/tools/projects

Failure Logs

No response

Package Manager Version

No response

Operating System

  • macOS
  • Linux
  • Windows
  • Other (Please specify)

Additional Information

Project built using @nx/angular:webpack-browser builder, with buildLibsFromSource set to false and a custom webpack configuration file
webpack-browser could not load the generated tsconfig files from temp folder.

when buildLibsFromSource is set to false the builder generated a new temporary tsconfig file (tsconfig.generated.json) with ts-paths of
all its dependant projects remapped to build JS files in dist folder.

The path of the generated tsConfig file is a fully qualified path,
https://github.com/nrwl/nx/blob/master/packages/angular/src/builders/webpack-browser/webpack-browser.impl.ts#L81-L90 PR
#19451 introduces a change in webpack
(https://github.com/nrwl/nx/blob/master/packages/angular/src/builders/utilities/webpack.ts#L14) to join the tsConfig with workspace root
path and this is would result in file not found.

Copy link

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 25, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated scope: angular Issues related to Angular support in Nx type: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants