This directory contains code that is shared between
The pattern used here is referred to as “limited sharing” unlike the chrome://resources approach which is “unlimited sharing”.
This approach has the following advantages over moving shared code under chrome://resources/:
The “limited sharing” mechanism works as follows
kSettingsSharedResources
are included in the build once and registered at runtime under all WebUIDataSource instances that need to use this code.ts_path_mappings
and optimize_webui_external_paths
parameters are leveraged so that the respective underlying tools (TS compiler and Rollup) can correctly resolve such paths.A similar approach is also followed in c/b/r/side_panel/shared.
Note: The files in this folder are only added as standalone files to the build when optimize_webui=false
. In other cases the same files are already bundled within the UIs that use them and therefore adding them as standalone files is unnecessary.