Is there a way to minify or bundle or pack blazor wasm js?

RSa 0 Reputation points
2024-04-16T14:41:52.6333333+00:00

Is there a way to minify or bundle or pack blazor wasm js?

 

For example all of these files that get downloaded, some of them are third party libs but I want a generic "pack any js" into one file library.

 

 

Blazor
Blazor
A free and open-source web framework that enables developers to create web apps using C# and HTML being developed by Microsoft.
1,596 questions
{count} votes

3 answers

Sort by: Most helpful
  1. Bruce (SqlWork.com) 66,461 Reputation points
    2024-04-16T19:24:05.2333333+00:00

    the blazor.js files are already minimized. you should avoid js components with blazor. there are several common bundlers, webpack, Parcel or rollup.


  2. Ping Ni-MSFT 4,720 Reputation points Microsoft Vendor
    2024-04-17T06:18:10.58+00:00

    Hi @RSa,
    According to the Microsoft Documentation, ASP.NET Core is compatible with WebOptimizer, an open-source bundling and minification solution. For set up instructions and sample projects, see WebOptimizer. ASP.NET Core doesn't provide a native bundling and minification solution.


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
    Best regards,
    Rena


  3. A SIVAGAYATHRI 0 Reputation points
    2024-09-29T13:04:36.44+00:00

    Yes, you can minify and bundle Blazor WebAssembly (WASM) JavaScript by using the built-in optimization features provided by .NET. During the production build (dotnet publish -c Release), Blazor automatically minifies and bundles the JavaScript files to reduce the overall size for faster load times. You can also use additional tools like Webpack or custom build steps if needed for more control.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.