-
Notifications
You must be signed in to change notification settings - Fork 209
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
hard coded tsconfig #750
Comments
Hi, you are right. Yes, feel free to provide an PR. |
I noticed you're making a copy of the currently used tsconfig (coming from the dev server configuration): function createTsConfigForFederation(
workspaceRoot: string,
tsConfigPath: string,
entryPoints: EntryPoint[]
) {
const fullTsConfigPath = path.join(workspaceRoot, tsConfigPath);
const tsconfigDir = path.dirname(fullTsConfigPath);
...
const tsconfigAsString = fs.readFileSync(fullTsConfigPath, 'utf-8');
const tsconfig = JSON5.parse(tsconfigAsString);
...
const content = JSON5.stringify(tsconfig, null, 2);
const tsconfigFedPath = path.join(tsconfigDir, 'tsconfig.federation.json');
if (!doesFileExist(tsconfigFedPath, content)) {
fs.writeFileSync(tsconfigFedPath, JSON.stringify(tsconfig, null, 2));
} The simplest solution for this issue would be to reuse tsconfig.federation.json. Changing the find function to this: export function findRootTsConfigJson(): string {
const packageJson = findPackageJson(cwd());
const projectRoot = path.dirname(packageJson);
const tsConfigJson = path.join(projectRoot, 'tsconfig.federation.json');
if (fs.existsSync(tsConfigJson)) {
return tsConfigJson;
}
throw new Error('tsconfig.federation.json could not be found');
} |
The thing is that this file can be overwritten by the builder and as soon as the Angular compiler permits, we won't use it anymore. Hence, in future versions there might not be such a file anymore. |
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:
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.
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
The text was updated successfully, but these errors were encountered: