ImportMap Tag in Oqtane #5183
-
Hi, Can Oqtane incorporate an Blazor Web App -> App.razor file: Browser Rendered Scripts: |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 5 replies
-
@Sharafudeen no Oqtane does not support the new ImportMap as it uses its own method for defining Resources in modules/themes. |
Beta Was this translation helpful? Give feedback.
-
@sbwalker Understood. However, why is it necessary to define all dependent JavaScript files in the resources when we’ve already referenced the dependent DLLs in the Dependencies property? Since we are using Blazor, minimizing JavaScript dependencies is a key objective, which is why we are opting for MudBlazor and MudBlazor.Extensions. In the Blazor Web App project template, when adding MudBlazor and MudBlazor.Extensions, the CSS and JavaScript files are automatically loaded with their dependencies. Is there a way to implement this functionality in Oqtane? |
Beta Was this translation helpful? Give feedback.
-
Referencing the dependent DLLs in the Dependencies property does not provide Oqtane any information about the static resources which those DLLs rely upon. All of the information about static resources are stored in the Nuget package - which is not an artifact which Oqtane can interogate at run-time to obtain the dependency information. Therefore, the static resources need to be declared in the component. Standard Blazor avoids this problem because it is not modular - it assumes that all of an application's dependencies are tightly coupled and linked to the main Blazor project via Nuget references. It uses these references during BUILD to extract the static resources to the appropriate locations so that the application is able to reference them. This monolithic approach simplifies the management of static resources from a development perspective, however it comes at the expense of modularity, granular deployment, etc... If you want to use a modular approach then you need to take responsibility for understanding for the entire life cycle of your static assets.
Please note that by using MudBlazor or almost any third party UI component library, you are NOT minimizing JavaScript dependencies. These UI component libraries are usually just wrappers around tons of JavaScript - so by using them you are in fact MAXIMIZING your JavaScript dependencies. This fact is hidden from developers in standard Blazor because they are embedded in Nuget packages and magically extracted during BUILD time to your system so that you do not even know they exist - and you write your components against a strongly typed C# wrapper - which provides a native facade when you are actually executing a ton of JavaScript.
The short answer is NO.... as I explained above the development experience in standard Blazor focuses on monolithic, tightly coupled, static applications which rely on BUILD magic to orchestrate resources, and full-scale monolithic application deployments. Oqtane uses a totally different approach based on micro-frontends/services, loose coupling, dynamic applications which rely on RUNTIME orchestration and micro deployments.
The Bundle property on the Resource class is only used in Interactive render mode and provides a way for you to group together static JavaScript assets so that they are injected in a specific order. The Oqtane.Client\Modules\Controls\QuillJSTextEditor.razor is an example of an interactive component which has 3 JavaScript resources that must be declared in a specific order and use the Bundle property to achieve this. Technically, the Bundle concept is a feature of the LoadJS library which Oqtane uses for dynamically loading scripts.
I fixed this issue today and it will be included in the next release (#5188) |
Beta Was this translation helpful? Give feedback.
@Sharafudeen
Referencing the dependent DLLs in the Dependencies property does not provide Oqtane any information about the static resources which those DLLs rely upon. All of the information about static resources are stored in the Nuget package - which is not an artifact which Oqtane can interogate at run-time to obtain the dependency information. Therefore, the static resources need to be declared in the component.
Standard Blazor avoids this problem because it is not modular - it assumes that all of an appl…