<?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: Khervie00</title>
    <description>The latest articles on DEV Community by Khervie00 (@khervie00).</description>
    <link>https://dev.to/khervie00</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%2F449994%2Fc9707841-328a-4713-bc95-43312b47da07.jpg</url>
      <title>DEV Community: Khervie00</title>
      <link>https://dev.to/khervie00</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/khervie00"/>
    <language>en</language>
    <item>
      <title>Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of “text/html”....</title>
      <dc:creator>Khervie00</dc:creator>
      <pubDate>Tue, 08 Oct 2024 13:01:47 +0000</pubDate>
      <link>https://dev.to/khervie00/failed-to-load-module-script-expected-a-javascript-module-script-but-the-server-responded-with-a-mime-type-of-texthtml-2kg2</link>
      <guid>https://dev.to/khervie00/failed-to-load-module-script-expected-a-javascript-module-script-but-the-server-responded-with-a-mime-type-of-texthtml-2kg2</guid>
      <description>&lt;p&gt;&lt;a href="https://media.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%2Folio5h39up21btddbwg6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Folio5h39up21btddbwg6.png" alt="Failed to load module script; https://answers.netlify.com/t/failed-to-load-module-script-error-intermittently-serving-our-base-index-html-spa-file-instead-of-js-module/111966" width="800" height="233"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You might come across this error when trying to preview or load up your after building and deploying, say on netlify.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of “text/html”. Strict MIME type checking is enforced for module scripts per HTML spec&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;It can be pretty annoying because your tests and build passes and even deploys but when you launch the web app, you're met with a blank empty white page.&lt;/p&gt;


&lt;div class="crayons-card c-embed text-styles text-styles--secondary"&gt;
      &lt;div class="c-embed__cover"&gt;
        &lt;a href="https://giphy.com/embed/11tTNkNy1SdXGg" class="c-link s:max-w-50 align-middle" rel="noopener noreferrer"&gt;
          &lt;img alt="" src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmedia0.giphy.com%2Fmedia%2F11tTNkNy1SdXGg%2F200.gif%3Fcid%3Ddda24d50pdprgt2qg4kordz4p6vcuxpy45ai95jc5zn8cyby%26ep%3Dv1_internal_gif_by_id%26rid%3D200.gif%26ct%3Dg" height="200" class="m-0" width="360"&gt;
        &lt;/a&gt;
      &lt;/div&gt;
    &lt;div class="c-embed__body"&gt;
      &lt;h2 class="fs-xl lh-tight"&gt;
        &lt;a href="https://giphy.com/embed/11tTNkNy1SdXGg" rel="noopener noreferrer" class="c-link"&gt;
          Angry Inside Out GIF by Disney Pixar - Find &amp;amp; Share on GIPHY
        &lt;/a&gt;
      &lt;/h2&gt;
        &lt;p class="truncate-at-3"&gt;
          Discover &amp;amp; share this Disney Pixar GIF with everyone you know. GIPHY is how you search, share, discover, and create GIFs.
        &lt;/p&gt;
      &lt;div class="color-secondary fs-s flex items-center"&gt;
        giphy.com
      &lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;


&lt;h2&gt;
  
  
  What can you do?
&lt;/h2&gt;

&lt;p&gt;After combing the internet in search of a solution with no success, i found one with the exact same issue &lt;a href="https://answers.netlify.com/t/failed-to-load-module-script-expected-a-javascript-module-script-but-the-server-responded-with-a-mime-type-of-text-html-strict-mime-type-checking-is-enforced-for-module-scripts-per-html-spec/122743" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Open your &lt;code&gt;vite.config.js&lt;/code&gt; file in your project folder and edit it to look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;export default defineConfig({
  server: {
    port: 3000,
    hmr: {
      host: "localhost",
    },
  },
  plugins: [], // Add your plugins here

  base: "/", // Take note of this!!

 // Add the rest of your build and vite config.
});

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I mean add this line to your &lt;code&gt;vite.config.js&lt;/code&gt;, if you haven't already:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  base: "/"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Or you can follow &lt;a href="https://answers.netlify.com/t/failed-to-load-module-script-expected-a-javascript-module-script-but-the-server-responded-with-a-mime-type-of-text-html-strict-mime-type-checking-is-enforced-for-module-scripts-per-html-spec/122743" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  What happened? (Cause of the whole wahala).
&lt;/h2&gt;

&lt;p&gt;So a brief breakdown, if you encounter this and open your browser console and go to the sources area, open the folder that contains your webapp, you'll see your &lt;code&gt;index.html&lt;/code&gt; as well as your &lt;code&gt;assets&lt;/code&gt; folder that "should" contain your &lt;code&gt;index-${hash}.css&lt;/code&gt; and &lt;code&gt;index-${hash}.js&lt;/code&gt; that shows your compiled and minified Css and Javascript code, just as you saw after building in the &lt;code&gt;dist&lt;/code&gt; folder (I know you know all this blah blah blah).&lt;/p&gt;

&lt;p&gt;If you should open your &lt;code&gt;index-${hash}.css&lt;/code&gt; or &lt;code&gt;index-${hash}.js&lt;/code&gt;, it should show you your css and JS code yeah? But only it doesn't. Here's the funny part, it returns the contents of your html instead.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Here's why;&lt;/strong&gt; The browser tries to fetch your js and css assets using the &lt;strong&gt;&lt;em&gt;"path"&lt;/em&gt;&lt;/strong&gt; in the &lt;code&gt;/index.html&lt;/code&gt; then the rewrite would return the contents of the &lt;code&gt;/index.html&lt;/code&gt; and the the browser trying to access a &lt;code&gt;Javascript MIME type&lt;/code&gt;from your js file but fails because your js file served an &lt;code&gt;html type&lt;/code&gt;, hence the error&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of “text/html”. Strict MIME type checking is enforced for module scripts per HTML spec&lt;/em&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This is usually common in projects deployed under a nested public path, when built, it follows the path accordingly and on deployment, might fail to read imported assets references like your css and JS, so specifying the &lt;code&gt;base path&lt;/code&gt; would rewrite all assets accordingly, i.e &lt;code&gt;JS-imported asset refs&lt;/code&gt;, &lt;code&gt;CSS url refs&lt;/code&gt;, and asset references in your &lt;code&gt;.html&lt;/code&gt; files are all automatically adjusted to respect this option during build.&lt;/p&gt;

&lt;p&gt;All the long talk to just to really tell you to specify your &lt;code&gt;base&lt;/code&gt; property in your &lt;code&gt;vite config&lt;/code&gt; &lt;strong&gt;&lt;code&gt;(change to "/")&lt;/code&gt;&lt;/strong&gt; like we did earlier.&lt;/p&gt;

&lt;p&gt;Saves time and stress!&lt;/p&gt;

&lt;p&gt;You're welcome 😉.&lt;br&gt;
Follow me on &lt;a href="https://x.com/khervie00" rel="noopener noreferrer"&gt;X&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Relevant links
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://answers.netlify.com/t/failed-to-load-module-script-expected-a-javascript-module-script-but-the-server-responded-with-a-mime-type-of-text-html-strict-mime-type-checking-is-enforced-for-module-scripts-per-html-spec/122743/6" rel="noopener noreferrer"&gt;Reference&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://vitejs.dev/guide/build.html#public-base-path" rel="noopener noreferrer"&gt;https://vitejs.dev/guide/build.html#public-base-path&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://vitejs.dev/config/shared-options.html#base" rel="noopener noreferrer"&gt;https://vitejs.dev/config/shared-options.html#base&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>vite</category>
      <category>frontend</category>
      <category>javascript</category>
      <category>help</category>
    </item>
    <item>
      <title>Design Struggles as a UI developer.</title>
      <dc:creator>Khervie00</dc:creator>
      <pubDate>Sun, 06 Oct 2024 06:41:39 +0000</pubDate>
      <link>https://dev.to/khervie00/design-struggles-as-a-ui-developer-3mmb</link>
      <guid>https://dev.to/khervie00/design-struggles-as-a-ui-developer-3mmb</guid>
      <description>&lt;p&gt;"This thing on?"&lt;/p&gt;

&lt;p&gt;Hi there, I'm khervie00, an indie UI developer. When I say UI development, I mean everything that concerns frontend development, Web, mobile(but not desktop yet😅😅).&lt;/p&gt;

&lt;p&gt;And if you're a fellow indie UI dev like me, you'll agree that sourcing for sleek and crispy UI designs can be one of the hardest things to do(after trying to crack diamond).&lt;/p&gt;

&lt;p&gt;I mean, there's the option of contacting your UI designer friend who you know cooks good but will definitely charge you and its not that you do not want to pay, because obviously they are professionals and needs to get paid for a service rendered, but where's the money to finance that?&lt;/p&gt;


&lt;div class="crayons-card c-embed text-styles text-styles--secondary"&gt;
      &lt;div class="c-embed__cover"&gt;
        &lt;a href="https://tenor.com/view/dave-chappelle-broke-im-so-im-broke-gif-12868816" class="c-link s:max-w-50 align-middle" rel="noopener noreferrer"&gt;
          &lt;img alt="" src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmedia1.tenor.com%2Fm%2Fe8okZA5YE2AAAAAC%2Fdave-chappelle-broke.gif" height="374" class="m-0" width="498"&gt;
        &lt;/a&gt;
      &lt;/div&gt;
    &lt;div class="c-embed__body"&gt;
      &lt;h2 class="fs-xl lh-tight"&gt;
        &lt;a href="https://tenor.com/view/dave-chappelle-broke-im-so-im-broke-gif-12868816" rel="noopener noreferrer" class="c-link"&gt;
          Dave Chappelle Broke GIF - Dave Chappelle Broke Im - Discover &amp;amp; Share GIFs
        &lt;/a&gt;
      &lt;/h2&gt;
        &lt;p class="truncate-at-3"&gt;
          Click to view the GIF
        &lt;/p&gt;
      &lt;div class="color-secondary fs-s flex items-center"&gt;
          &lt;img alt="favicon" class="c-embed__favicon m-0 mr-2 radius-0" src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Ftenor.com%2Fassets%2Fimg%2Ffavicon%2Ffavicon-16x16.png" width="16" height="16"&gt;
        tenor.com
      &lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;


&lt;h4&gt;
  
  
  &lt;strong&gt;So what do you do?&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;What I do is, (&lt;em&gt;Walk with me&lt;/em&gt; 😂😂😂)&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;This is really stressful so just hire a UI designer if you want soft life!!😖😖&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;What I do is basically what a UI designer will do, and what many of you will also do. Analyse the project you want to build mentally, speak to yourself.(People may think you're already going insane but &lt;em&gt;no phor&lt;/em&gt;(I dey your back!!)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;After that, take some notes, it helps for research. (Im literally just saying this, I dont really do it either, But when I did a couple of times, it helped).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The go over to figma community and search for some ideas relating to your project idea, have a quick scan at some of them (&lt;strong&gt;To be honest, many of them are not the best when it comes to quality of design, but just helps to give a visual idea and a thought process&lt;/strong&gt; 😂😂😂😂). &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Head over to &lt;a href="https://dribbble.com/" rel="noopener noreferrer"&gt;Dribble&lt;/a&gt; and /or &lt;a href="https://behance.com" rel="noopener noreferrer"&gt;Behance&lt;/a&gt;, same thing but better designs, only that these ones show limited screens(UIs) and so many different options.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;The majority of the work comes from your brain, dear developer, having to measure up and calculate and recalculate, and align and make sure colors, fonts and images are not out of place to give something aesthetically pleasing. or just hire a UI designer 😂😂😂&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;Can say this because, Ive tried it multiple times, and it works(not everytime though) and it &lt;strong&gt;REALLLY&lt;/strong&gt; improves your UI and UX sense, gives you this touch and you start to pay attention to details. But its &lt;strong&gt;REALLLLLLLY&lt;/strong&gt; time consuming, can't iterate that enough. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;But at the end of the day, there's this touch and crispiness that the UI designers bring(good ones oh🙄) and the difference is usually clear.&lt;/p&gt;


&lt;div class="crayons-card c-embed text-styles text-styles--secondary"&gt;
      &lt;div class="c-embed__cover"&gt;
        &lt;a href="https://giphy.com/embed/3o7TKRwpns23QMNNiE" class="c-link s:max-w-50 align-middle" rel="noopener noreferrer"&gt;
          &lt;img alt="" src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmedia4.giphy.com%2Fmedia%2F3o7TKRwpns23QMNNiE%2F200.gif%3Fcid%3Ddda24d50zc9kguc4gvlg74v63m465gc7jpdz2z45w2ptyr22%26ep%3Dv1_internal_gif_by_id%26rid%3D200.gif%26ct%3Dg" height="200" class="m-0" width="292"&gt;
        &lt;/a&gt;
      &lt;/div&gt;
    &lt;div class="c-embed__body"&gt;
      &lt;h2 class="fs-xl lh-tight"&gt;
        &lt;a href="https://giphy.com/embed/3o7TKRwpns23QMNNiE" rel="noopener noreferrer" class="c-link"&gt;
          Stressed Over It GIF by HULU - Find &amp;amp; Share on GIPHY
        &lt;/a&gt;
      &lt;/h2&gt;
        &lt;p class="truncate-at-3"&gt;
          GIF it up for GIFs from your favorite TV shows, Hulu Originals and Exclusive programming, but it doesn't stop there. Sign up for Hulu now: hulu.com/welcome
        &lt;/p&gt;
      &lt;div class="color-secondary fs-s flex items-center"&gt;
        giphy.com
      &lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;


&lt;blockquote&gt;
&lt;p&gt;So fellow indie UI developer? What's your workaround? 🎤🎤&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Follow me on &lt;a href="https://x.com/khervie00" rel="noopener noreferrer"&gt;X (FKA Twitter)&lt;/a&gt; 😉.&lt;/p&gt;

</description>
      <category>frontend</category>
      <category>figma</category>
      <category>ui</category>
      <category>uidesign</category>
    </item>
  </channel>
</rss>
