<?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: Luiz Vicente</title>
    <description>The latest articles on DEV Community by Luiz Vicente (@luiztux).</description>
    <link>https://dev.to/luiztux</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%2F1149895%2F8e0049f6-1b28-4657-962d-d6d0466ad174.png</url>
      <title>DEV Community: Luiz Vicente</title>
      <link>https://dev.to/luiztux</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/luiztux"/>
    <language>en</language>
    <item>
      <title>Funtoo: the end of a Linux distro</title>
      <dc:creator>Luiz Vicente</dc:creator>
      <pubDate>Wed, 31 Jul 2024 16:54:31 +0000</pubDate>
      <link>https://dev.to/luiztux/funtoo-the-end-of-a-linux-distro-48n5</link>
      <guid>https://dev.to/luiztux/funtoo-the-end-of-a-linux-distro-48n5</guid>
      <description>&lt;h2&gt;
  
  
  What is Funtoo Linux?
&lt;/h2&gt;

&lt;p&gt;As a long-time user (18 years to be exact) of Funtoo/Gentoo, I confess to being very sad about this news, but everything has a beginning, middle and end.&lt;/p&gt;

&lt;p&gt;For those who don't know, &lt;a href="https://www.funtoo.org/Welcome" rel="noopener noreferrer"&gt;Funtoo&lt;/a&gt; is a GNU/Linux distro (or Linux-based, for the more traditional) that has its roots in &lt;a href="https://www.gentoo.org/" rel="noopener noreferrer"&gt;Gentoo Linux&lt;/a&gt;. Both distros are compiled, which means that to install any package on your operating system, you will need to compile the sources and build the packages.&lt;/p&gt;

&lt;p&gt;Funtoo and Gentoo are actually just one part of the whole: &lt;a href="https://wiki.gentoo.org/wiki/Portage" rel="noopener noreferrer"&gt;Portage&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Portage is the package manager (written in Python), the heart of these distros. From it you can build your Funtoo or Gentoo, or any other distro you want. Even one that doesn't exist.&lt;/p&gt;

&lt;p&gt;Both distros were created by Daniel Robbins, a guy who even worked at Microsoft after a while. You can read a bit of Gentoo's history &lt;a href="https://wiki.gentoo.org/wiki/Gentoo_History" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  All Good Things Must Come to an End...
&lt;/h2&gt;

&lt;p&gt;And it was with this title that Daniel Robbins announced the end of the distro, &lt;a href="https://forums.funtoo.org/topic/5182-all-good-things-must-come-to-an-end/" rel="noopener noreferrer"&gt;on the Funtoo forum&lt;/a&gt;:&lt;/p&gt;

&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%2Fwjevbo5pyqfhm8xqkhy1.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%2Fwjevbo5pyqfhm8xqkhy1.png" alt="Daniel Robbins announce"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;That's it folks. It's really a shame it's come to an end.&lt;/p&gt;

</description>
      <category>funtoo</category>
      <category>linux</category>
      <category>danielrobbins</category>
    </item>
    <item>
      <title>Deploy ReactJs website on Apache server (Hostgator) with Vite</title>
      <dc:creator>Luiz Vicente</dc:creator>
      <pubDate>Thu, 20 Jun 2024 13:34:41 +0000</pubDate>
      <link>https://dev.to/luiztux/deploy-reactjs-website-on-apache-server-hostgator-with-vite-jl6</link>
      <guid>https://dev.to/luiztux/deploy-reactjs-website-on-apache-server-hostgator-with-vite-jl6</guid>
      <description>&lt;h2&gt;
  
  
  Why on earth deploy to Apache/Hostgator?
&lt;/h2&gt;

&lt;p&gt;To see if it works. That simple.&lt;/p&gt;

&lt;p&gt;And does it work? Of course it works, but it needs a few things to make it work properly.&lt;/p&gt;

&lt;h2&gt;
  
  
  Let's go from the beginning
&lt;/h2&gt;

&lt;p&gt;It's a simple website, but it will be in a subfolder. For example:&lt;br&gt;
&lt;code&gt;https://mydomain.com/site2&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Having defined this, chances are that you use a Router (react-router-dom, TanStack Router, etc.). I use react-router-dom a lot, so this case is no different.&lt;/p&gt;
&lt;h2&gt;
  
  
  Configs
&lt;/h2&gt;
&lt;h3&gt;
  
  
  package.json
&lt;/h3&gt;

&lt;p&gt;As the website will be in a subfolder, you need to add the &lt;code&gt;homepage&lt;/code&gt; tag to your &lt;code&gt;package.json&lt;/code&gt; file, otherwise the build will assume that your project is hosted in the root of the server.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="p"&gt;...&lt;/span&gt;
  &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;homepage&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;https://mydomain.com/site2/&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;...&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  BrowserRouter config
&lt;/h3&gt;

&lt;p&gt;Add the &lt;code&gt;basename&lt;/code&gt; prop to the BrowserRouter:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;BrowserRouter&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;react-router-dom&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;Router&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./routes/Router&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;App&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;BrowserRouter&lt;/span&gt; &lt;span class="nx"&gt;basename&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/site2&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Router&lt;/span&gt; &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/BrowserRouter&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;  &lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  vite.config.js
&lt;/h3&gt;

&lt;p&gt;Without this step, no matter what you do, when you run &lt;code&gt;vite build&lt;/code&gt;, the generated &lt;code&gt;index.html&lt;/code&gt; file will have the wrong link references. Therefore, this configuration is crucial.&lt;br&gt;
All you need to do is add the &lt;code&gt;base&lt;/code&gt; option in the &lt;code&gt;vite.config.js&lt;/code&gt; file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;defineConfig&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;vite&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;react&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;@vitejs/plugin-react&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;

&lt;span class="c1"&gt;// https://vitejs.dev/config/&lt;/span&gt;
&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nf"&gt;defineConfig&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;base&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/site2/&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;plugins&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nf"&gt;react&lt;/span&gt;&lt;span class="p"&gt;()],&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Or via the &lt;code&gt;vite build --base=/my/public/path/&lt;/code&gt; flag.&lt;/p&gt;

&lt;p&gt;Finally, just run the build. In my case, I use &lt;code&gt;pnpm&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pnpm run build
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Configuring Apache
&lt;/h3&gt;

&lt;p&gt;Right. But for all of this to work online, you still need to configure Apache, using the &lt;code&gt;.htaccess&lt;/code&gt; file.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;You need to have this file in the folder where the index.html will be located&lt;/strong&gt;. Therefore, create the file in the folder, in my case, &lt;code&gt;/site2&lt;/code&gt;, with the following content:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight apache"&gt;&lt;code&gt;&lt;span class="nc"&gt;RewriteEngine&lt;/span&gt; &lt;span class="ss"&gt;On&lt;/span&gt;
&lt;span class="nc"&gt;RewriteBase&lt;/span&gt; /site2
&lt;span class="nc"&gt;RewriteCond&lt;/span&gt; %{REQUEST_FILENAME} !-f
&lt;span class="nc"&gt;RewriteRule&lt;/span&gt; ^ index.html [L]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Finally, upload the files from your project's &lt;code&gt;dist&lt;/code&gt; folder to your Apache folder. Don't forget the files in the &lt;code&gt;assets&lt;/code&gt; folder.&lt;/p&gt;

&lt;p&gt;That's it!&lt;/p&gt;

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