<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: ferouzkassim</title>
    <description>The latest articles on DEV Community by ferouzkassim (@ferouzkassim).</description>
    <link>https://dev.to/ferouzkassim</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F541032%2Fa3093770-57a9-4be9-a1c8-41e5e38e0bfd.png</url>
      <title>DEV Community: ferouzkassim</title>
      <link>https://dev.to/ferouzkassim</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ferouzkassim"/>
    <language>en</language>
    <item>
      <title>Asp.net javascript bundling</title>
      <dc:creator>ferouzkassim</dc:creator>
      <pubDate>Thu, 27 Mar 2025 09:03:27 +0000</pubDate>
      <link>https://dev.to/ferouzkassim/aspnet-javascript-bundling-6ph</link>
      <guid>https://dev.to/ferouzkassim/aspnet-javascript-bundling-6ph</guid>
      <description>&lt;p&gt;Javascript Failed to import Modules with asp.net back end &lt;/p&gt;

&lt;p&gt;hey there are you using and failing in the browser&lt;/p&gt;

&lt;p&gt;import {package} form "packageName" &lt;/p&gt;

&lt;p&gt;well yes the browser cannot undesrtand your node modules you need a bundler to build the javascript esmModules to js files e.g parcel, webpack, Vite &lt;/p&gt;

&lt;p&gt;yes this will work but hold on. &lt;/p&gt;

&lt;p&gt;What if you have a back end with asp.net my choice is Vite.&lt;/p&gt;

&lt;p&gt;A nugget with detailed instructions is here &lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/Eptagone/Vite.AspNetCore" rel="noopener noreferrer"&gt;https://github.com/Eptagone/Vite.AspNetCore&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;`using Vite.AspNetCore;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;`&lt;br&gt;
// ---- Service Configuration ----&lt;/p&gt;

&lt;p&gt;// Add Vite services.&lt;/p&gt;

&lt;p&gt;builder.Services.AddViteServices();&lt;/p&gt;

&lt;p&gt;// ---- App Configuration ----&lt;/p&gt;

&lt;p&gt;// Use the Vite Development Server when the environment is Development.&lt;/p&gt;

&lt;p&gt;if (app.Environment.IsDevelopment())&lt;/p&gt;

&lt;p&gt;{&lt;/p&gt;

&lt;p&gt;// WebSockets support is required for HMR (hot module reload).&lt;/p&gt;

&lt;p&gt;// Uncomment the following line if your pipeline doesn't contain it.&lt;/p&gt;

&lt;p&gt;// app.UseWebSockets();&lt;/p&gt;

&lt;p&gt;// Enable all required features to use the Vite Development Server.&lt;/p&gt;

&lt;p&gt;// Pass true if you want to use the integrated middleware.&lt;/p&gt;

&lt;p&gt;app.UseViteDevelopmentServer(/* false */);&lt;/p&gt;

&lt;p&gt;}&lt;br&gt;
`&lt;code&gt;&lt;/code&gt;&lt;br&gt;
`&lt;/p&gt;

&lt;p&gt;thats all and we are good` to go so Vite will build your Esm Modules and generate a main.js file which you will impoert in you layout.cshtml file with this the browser willl reference your imports from that main js file &lt;/p&gt;

&lt;p&gt;hope you find this usefull&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjxiq2ffhqhi1i9k2qloh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjxiq2ffhqhi1i9k2qloh.png" alt="Image description" width="800" height="38"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
