build: eliminate frontend chunk and Rust dead code warnings
- Split React, Tauri, DnD, and icon dependencies into vendor chunks - Reduce the main application chunk below the warning threshold - Compile test-only alias helpers only during test builds
This commit is contained in:
1 parent
bb8f23cbc8
commit
3b9e3b9fd4
2 files changed
+24
No files matched your search
@@ -374,6 +374,7 @@ pub(crate) fn ensure_claude_desktop_model_aliases_with_codex_oauth_in_yaml(
|
||||
render_updated_core_yaml(&mut document, updated)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
pub(crate) fn remove_managed_claude_model_aliases_in_yaml(content: &str) -> Result<String, String> {
|
||||
let mut document = yaml_serde_edit::YamlValue::parse(content)
|
||||
.map_err(|error| format!("解析内核 YAML 配置失败: {error}"))?;
|
||||
@@ -773,6 +774,7 @@ pub(crate) async fn fetch_oauth_model_definitions(
|
||||
definitions
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
pub(crate) fn resolved_thinking_alias_sources(
|
||||
content: &str,
|
||||
definitions: &[CodexModelDefinition],
|
||||
@@ -787,6 +789,7 @@ pub(crate) fn resolved_thinking_alias_sources(
|
||||
)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
pub(crate) fn resolved_speed_alias_sources(
|
||||
content: &str,
|
||||
definitions: &[CodexModelDefinition],
|
||||
@@ -801,6 +804,7 @@ pub(crate) fn resolved_speed_alias_sources(
|
||||
)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
pub(crate) fn resolved_alias_sources(
|
||||
content: &str,
|
||||
definitions: &[CodexModelDefinition],
|
||||
@@ -820,6 +824,7 @@ pub(crate) fn resolved_alias_sources(
|
||||
)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
pub(crate) fn codex_oauth_definition_set(
|
||||
definitions: &[CodexModelDefinition],
|
||||
) -> Vec<OAuthModelDefinitions> {
|
||||
@@ -1758,6 +1763,7 @@ pub(crate) fn append_config_speed_alias(
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
pub(crate) fn remove_thinking_alias_from_yaml(
|
||||
content: &str,
|
||||
alias: &str,
|
||||
@@ -1789,6 +1795,7 @@ pub(crate) fn remove_thinking_alias_from_yaml_for_channel(
|
||||
render_updated_core_yaml(&mut document, updated)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
pub(crate) fn remove_speed_alias_from_yaml(content: &str, alias: &str) -> Result<String, String> {
|
||||
remove_speed_alias_from_yaml_for_channel(content, alias, None)
|
||||
}
|
||||
|
||||
@@ -11,5 +11,22 @@ export default defineConfig({
|
||||
build: {
|
||||
target: 'es2020',
|
||||
outDir: 'dist',
|
||||
rollupOptions: {
|
||||
output: {
|
||||
manualChunks(id) {
|
||||
const normalizedId = id.replaceAll('\\', '/');
|
||||
if (!normalizedId.includes('/node_modules/')) return undefined;
|
||||
if (normalizedId.includes('/node_modules/@tauri-apps/')) return 'tauri-vendor';
|
||||
if (normalizedId.includes('/node_modules/@dnd-kit/')) return 'dnd-vendor';
|
||||
if (normalizedId.includes('/node_modules/lucide-react/')) return 'icons-vendor';
|
||||
if (
|
||||
normalizedId.includes('/node_modules/react/')
|
||||
|| normalizedId.includes('/node_modules/react-dom/')
|
||||
|| normalizedId.includes('/node_modules/scheduler/')
|
||||
) return 'react-vendor';
|
||||
return 'vendor';
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
Reference in new issue
Block a user