Skip to content

hard coded tsconfig #750

Open
Open
@asollberger

Description

@asollberger

With what library do you have an issue?

native-federation

Reproduction of the bug/regression with instructions

Dear Angular Architects

I tried to specify the tsconfig to be used for a native federation run through the angular.json configuration only to find out that it was entirely ignored.

... so I looked into the code and found this hard coding:

export function findRootTsConfigJson(): string {
  const packageJson = findPackageJson(cwd());
  const projectRoot = path.dirname(packageJson);
  const tsConfigBaseJson = path.join(projectRoot, 'tsconfig.base.json');
  const tsConfigJson = path.join(projectRoot, 'tsconfig.json');

  if (fs.existsSync(tsConfigBaseJson)) {
    return tsConfigBaseJson;
  } else if (fs.existsSync(tsConfigJson)) {
    return tsConfigJson;
  }

  throw new Error('Neither a tsconfig.json nor a tsconfig.base.json was found');
}

Would it be possible to read the configured tsConfig file from angular.json instead (when present, I understand that you're supporting nx as well)?
f.ex.

                "esbuild": {
                    "builder": "@angular-devkit/build-angular:application",
                    "options": {
                        "index": "src/index.html",
                        "tsConfig": "tsconfig.dev.json",

Expected behavior

I'd be fine to create a PR if you can tell me how to properly read the information (I'm guessing it's not just simply reading angular.json, there's probably some angular way to access the parsed configuration).

Versions of Native/Module Federation, Angular, Node, Browser, and operating system

Using native federation v17 in prod, v18 in dev, moving to v19 soon

Other information

No response

I would be willing to submit a PR to fix this issue

  • Yes
  • No

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions