Skip to content

Fix[core] compiler option not recognized in monorepo problem#3004#3005

Closed
SisyphusZheng wants to merge 4 commits intodenoland:mainfrom
SisyphusZheng:fixcore]workspace-problem
Closed

Fix[core] compiler option not recognized in monorepo problem#3004#3005
SisyphusZheng wants to merge 4 commits intodenoland:mainfrom
SisyphusZheng:fixcore]workspace-problem

Conversation

@SisyphusZheng
Copy link
Contributor

Resolves issue where jsxImportSource from subproject's deno.json was not recognized, as Fresh was incorrectly using the root workspace config.

Closes: #3004

@SisyphusZheng SisyphusZheng marked this pull request as draft May 31, 2025 09:35
@SisyphusZheng SisyphusZheng changed the title Fix[core compiler option not recognized in monorepo problem#3004 Fix[core] compiler option not recognized in monorepo problem#3004 May 31, 2025
Comment on lines +268 to +290
// Merge configurations: app-level takes precedence over workspace-level
// This ensures Fresh apps can override JSX settings while still inheriting other configs
const mergedConfig: DenoConfig = {};
const rootConfig = configs[configs.length - 1]; // workspace root config
const appConfig = configs[0]; // application config

// Start with workspace root config as base
if (rootConfig.config.compilerOptions) {
mergedConfig.compilerOptions = { ...rootConfig.config.compilerOptions };
}

// Override with application-specific config, giving priority to JSX settings
if (appConfig.config.compilerOptions) {
mergedConfig.compilerOptions = {
...mergedConfig.compilerOptions,
...appConfig.config.compilerOptions,
};
}

// Always preserve workspace setting from the appropriate config
if (appConfig.config.workspace !== undefined) {
mergedConfig.workspace = appConfig.config.workspace;
} else if (rootConfig.config.workspace !== undefined) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems overly complicated. We have an array of config objects and we know that the first one is the app config (aka workspace member). So you can iterate over that array and check for every items if the necessary JSX compiler options are set. When you encounter such an config item, or when the config item as workspace set, abort.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool thx, i will fix it in next week

@marvinhagemeister
Copy link
Collaborator

Thanks for working on this. We needed this fix right now and went ahead by merging #3096 instead.

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

Successfully merging this pull request may close these issues.

jsxImportSource compiler option not recognized in monorepo setup

2 participants