[dev-v5] Refine dynamic external script loading#4506
Merged
Conversation
- Refine dynamic loading
|
✅ All tests passed successfully Details on your Workflow / Core Tests page. |
Summary - Unit Tests Code CoverageSummary
CoverageMicrosoft.FluentUI.AspNetCore.Components - 99.1%
|
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces build-mode awareness to the JavaScript build pipeline and refactors external library loading to support both production and debug URLs. The build mode (Debug or Release) is now determined at build time and controls minification, source map generation, and which CDN URLs are used for external libraries.
Changes:
- Build configuration now accepts a
--build-modeparameter that controls minification and source maps, with the mode written to a generatedBuildConstants.tsfile - External library loading refactored from separate name/URL parameters to a unified
Libraryinterface with support for both production and debug URLs - MSBuild integration updated to pass the Configuration (Debug/Release) to the npm build process
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Core.Scripts/src/ExternalLibs.ts | Introduced Library interface and refactored ExternalLibraryLoader to accept a Library object and select URLs based on build mode |
| src/Core.Scripts/src/Components/TextInput/TextMasked.ts | Updated to use the new Library interface and refactored loader constructor |
| src/Core.Scripts/src/BuildConstants.ts | New generated file containing the build mode constant |
| src/Core.Scripts/esbuild.config.mjs | Added build mode parsing, BuildConstants.ts generation, and conditional minification/source maps |
| src/Core.Scripts/Microsoft.FluentUI.AspNetCore.Components.Scripts.esproj | Updated SDK version and modified BuildCommand to pass Configuration to npm |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
dvoituron
requested changes
Feb 5, 2026
dvoituron
approved these changes
Feb 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR introduces build-mode awareness to the JavaScript build process and external library loading, allowing for different behaviors in Debug and Release configurations. The changes also refactor how external libraries are described and loaded, providing more flexibility and clarity.
Build process improvements:
esbuild.config.mjs) now accepts a--build-modeargument, which controls whether code is minified and if source maps are generated. It writes the build mode to a newBuildConstants.tsfile for use in the codebase. [1] [2]Microsoft.FluentUI.AspNetCore.Components.Scripts.esproj) is updated to pass the build mode from the MSBuild configuration to the npm build command.External library loading refactor:
ExternalLibs.tsfile introduces a newLibraryinterface, allowing each library to specify both production and debug URLs. TheExternalLibraryLoaderclass is updated to use this interface and to select the appropriate URL based on the build mode. [1] [2] [3] [4] [5]TextMasked.tsis updated to use the newLibraryinterface and the refactored loader.Now, when adding a new component which uses an external script, only the components ts file needs to be worked on. No changes to the 'ExternalLibs.ts` file are needed.
Example from the
TextMasked.tsfile: