<?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: Leonid Rezvitsky</title>
    <description>The latest articles on DEV Community by Leonid Rezvitsky (@rezvitsky).</description>
    <link>https://dev.to/rezvitsky</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%2F570130%2Fd682a296-400b-4a58-a82e-b24c6c122eb7.png</url>
      <title>DEV Community: Leonid Rezvitsky</title>
      <link>https://dev.to/rezvitsky</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/rezvitsky"/>
    <language>en</language>
    <item>
      <title>Vitejs SSR (Fastify, Vuejs)</title>
      <dc:creator>Leonid Rezvitsky</dc:creator>
      <pubDate>Fri, 31 Dec 2021 09:01:02 +0000</pubDate>
      <link>https://dev.to/rezvitsky/vitejs-ssr-fastify-vuejs-5a40</link>
      <guid>https://dev.to/rezvitsky/vitejs-ssr-fastify-vuejs-5a40</guid>
      <description>&lt;h1&gt;
  
  
  Vite SSR (Vue 3 + Vitejs + Fastify)
&lt;/h1&gt;

&lt;p&gt;
  &lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--HtxrKSrP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/Rezvitsky/vite-ssr-vue/main/preview.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--HtxrKSrP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/Rezvitsky/vite-ssr-vue/main/preview.png" width="800" height="306"&gt;&lt;/a&gt;
  &lt;br&gt;
&lt;/p&gt;



&lt;p&gt;Hey! For this stack, I used:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/fastify/fastify"&gt;Fastify&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/fastify/fastify-express"&gt;Fastify Express&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://vitejs.dev/"&gt;Vitejs&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://v3.vuejs.org/"&gt;Vuejs&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/JohnCampionJr/vite-plugin-vue-layouts"&gt;Vite plugin vue layouts&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/hannoeru/vite-plugin-pages"&gt;Vite plugin pages&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/antfu/unplugin-auto-import"&gt;Unplugin auto import&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/antfu/unplugin-vue-components"&gt;Unplugin vue components&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Repository: &lt;a href="https://github.com/Rezvitsky/vite-ssr-vue"&gt;https://github.com/Rezvitsky/vite-ssr-vue&lt;/a&gt;&lt;/p&gt;

</description>
      <category>vue</category>
      <category>vite</category>
      <category>fastify</category>
      <category>ssr</category>
    </item>
    <item>
      <title>Swap layout with Dribbble</title>
      <dc:creator>Leonid Rezvitsky</dc:creator>
      <pubDate>Sun, 14 Nov 2021 15:49:21 +0000</pubDate>
      <link>https://dev.to/rezvitsky/swap-layout-with-dribbble-3c04</link>
      <guid>https://dev.to/rezvitsky/swap-layout-with-dribbble-3c04</guid>
      <description>&lt;p&gt;I will use:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://vitejs.dev/"&gt;Vitejs&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://v3.vuejs.org/"&gt;Reactjs&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://reactrouter.com"&gt;React router dom&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://tailwindcss.com/"&gt;TailwindCSS&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--8aspKTuF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/Rezvitsky/swap-react-experiment/main/preview.webp%3Ftoken%3DAF6OYWTLKWJ4QVBEZCOHDL3BSEXEC" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--8aspKTuF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/Rezvitsky/swap-react-experiment/main/preview.webp%3Ftoken%3DAF6OYWTLKWJ4QVBEZCOHDL3BSEXEC" width="880" height="660"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Repo: &lt;a href="https://github.com/Rezvitsky/swap-react-experiment"&gt;https://github.com/Rezvitsky/swap-react-experiment&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Chrome Extension (Vue 3 + Vue Router + Typescript + Vite + TailwindCSS)</title>
      <dc:creator>Leonid Rezvitsky</dc:creator>
      <pubDate>Fri, 03 Sep 2021 18:01:04 +0000</pubDate>
      <link>https://dev.to/rezvitsky/chrome-extension-vue-3-vue-router-typescript-vite-tailwindcss-42d0</link>
      <guid>https://dev.to/rezvitsky/chrome-extension-vue-3-vue-router-typescript-vite-tailwindcss-42d0</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%2Fraw.githubusercontent.com%2FRezvitsky%2Fchrome-extension-vuejs%2Fmain%2Fpreview.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%2Fraw.githubusercontent.com%2FRezvitsky%2Fchrome-extension-vuejs%2Fmain%2Fpreview.png"&gt;&lt;/a&gt;
  &lt;br&gt;
&lt;/p&gt;



&lt;p&gt;&lt;strong&gt;Background&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Hey! To write the extension, I will use:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Vuejs&lt;/li&gt;
&lt;li&gt;Vue Router&lt;/li&gt;
&lt;li&gt;Vitejs&lt;/li&gt;
&lt;li&gt;TailwindCSS&lt;/li&gt;
&lt;li&gt;SASS&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Start 🚀
&lt;/h1&gt;

&lt;p&gt;To create a new project, run the command in the console:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm init vite@latest chrome-extension -- --template vue-ts
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  TailwindCSS
&lt;/h1&gt;

&lt;p&gt;To install TailwindCSS:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm install -D tailwindcss@latest postcss@latest autoprefixer@latest
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npx tailwindcss init -p
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Updates tailwind.config.js:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;module.exports = {
  purge: ['./index.html', './src/**/*.{vue,js,ts,jsx,tsx}'],
  darkMode: false, // or 'media' or 'class'
  theme: {
    extend: {},
  },
  variants: {
    extend: {},
  },
  plugins: [],
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the project I will use SASS to install it along with TailwindCSS, execute the following commands:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm install postcss-import
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Updates postcss.config.js:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;module.exports = {
  plugins: [
    require('postcss-import'),
    require('tailwindcss'),
    require('autoprefixer'),
  ]
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  SASS
&lt;/h1&gt;

&lt;p&gt;Install SASS with the command:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm i -D sass
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Create a &lt;code&gt;main.scss&lt;/code&gt; file in the &lt;code&gt;assets/scss&lt;/code&gt; folder with the following content:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@import "tailwindcss/base";
@import "tailwindcss/components";
@import "tailwindcss/utilities";

html {
    body {
        #app {
            height: 100%;
            width: 100%;
            overflow-x: hidden;
        }
        &amp;amp;.popup {
            width: 357px;
            min-height: 600px;
            height: 600px;
            max-height: 600px;
        }
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Connect the &lt;code&gt;main.scss&lt;/code&gt; into the &lt;code&gt;main.ts&lt;/code&gt; file&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import './assets/scss/main.scss'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Vue Router
&lt;/h1&gt;

&lt;p&gt;To install, run the command:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm i -S vue-router@4.x
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Create router/index.ts file with content:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { createRouter, createWebHashHistory, RouteRecordRaw } from 'vue-router'

const routes: Array&amp;lt;RouteRecordRaw&amp;gt; = [
    {
        path: '/',
        name: 'Index',
        component: () =&amp;gt; import('../views/Index.vue')
    },
    {
        path: '/about',
        name: 'About',
        component: () =&amp;gt; import('../views/About.vue')
    },
    {
        path: '/contacts',
        name: 'Contacts',
        component: () =&amp;gt; import('../views/Contacts.vue')
    },
]

const router = createRouter({
    history: createWebHashHistory(),
    routes
})

export default router
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Connect the &lt;code&gt;router/index.ts&lt;/code&gt; into the &lt;code&gt;main.ts&lt;/code&gt; file&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import router from './router'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For example pages, I created 3 files in the views folder: Index.vue, About.vue, Contacts.vue&lt;/p&gt;



&lt;p&gt;Index.vue&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;template&amp;gt;
  &amp;lt;div class="flex flex-col items-start w-full p-6 pb-8"&amp;gt;
        &amp;lt;div class="flex flex-col items-center w-full p-6 space-y-8 mt-4"&amp;gt;
            &amp;lt;div class="flex flex-col items-center space-y-3"&amp;gt;
                &amp;lt;span class="text-base"&amp;gt;Home&amp;lt;/span&amp;gt;
            &amp;lt;/div&amp;gt;
        &amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt; 
&amp;lt;/template&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;About.vue&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;template&amp;gt;
  &amp;lt;div class="flex flex-col items-start w-full p-6 pb-8"&amp;gt;
        &amp;lt;div class="flex flex-col items-center w-full p-6 space-y-8 mt-4"&amp;gt;
            &amp;lt;div class="flex flex-col items-center space-y-3"&amp;gt;
                &amp;lt;span class="text-base"&amp;gt;About&amp;lt;/span&amp;gt;
            &amp;lt;/div&amp;gt;
        &amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt; 
&amp;lt;/template&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Contacts.vue&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;template&amp;gt;
  &amp;lt;div class="flex flex-col items-start w-full p-6 pb-8"&amp;gt;
        &amp;lt;div class="flex flex-col items-center w-full p-6 space-y-8 mt-4"&amp;gt;
            &amp;lt;div class="flex flex-col items-center space-y-3"&amp;gt;
                &amp;lt;span class="text-base"&amp;gt;Contacts&amp;lt;/span&amp;gt;
            &amp;lt;/div&amp;gt;
        &amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt; 
&amp;lt;/template&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Manifest.json
&lt;/h1&gt;

&lt;p&gt;At the root of our project, create a manifest.json file:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
  "manifest_version": 2,
  "name": "Extension",
  "version": "0.1.0",
  "version_name": "0.1.0",
  "description": "Chrome Extension Example",
  "author": "Leonid Rezvitsky",
  "icons": {
    "128": "public/128.png"
  },
  "browser_action": {
    "default_popup": "dist/index.html",
    "default_title": "Extension"
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Build
&lt;/h1&gt;

&lt;p&gt;To build the extension, run the command:&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;Now go to the &lt;code&gt;chrome://extensions&lt;/code&gt; page and enable developer mode.&lt;/p&gt;



&lt;p&gt;Click on the button download the extension and select the folder where manifest.json is located in the crust.&lt;/p&gt;

&lt;p&gt;Repo: &lt;a href="https://github.com/Rezvitsky/chrome-extension-vuejs" rel="noopener noreferrer"&gt;https://github.com/Rezvitsky/chrome-extension-vuejs&lt;/a&gt;&lt;/p&gt;

</description>
      <category>chrome</category>
      <category>vue</category>
      <category>tailwindcss</category>
      <category>typescript</category>
    </item>
    <item>
      <title>Nodemon + Go App</title>
      <dc:creator>Leonid Rezvitsky</dc:creator>
      <pubDate>Tue, 10 Aug 2021 11:31:04 +0000</pubDate>
      <link>https://dev.to/rezvitsky/nodemon-go-app-2p7f</link>
      <guid>https://dev.to/rezvitsky/nodemon-go-app-2p7f</guid>
      <description>&lt;h1&gt;
  
  
  Nodemon + Go
&lt;/h1&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%2Fraw.githubusercontent.com%2FRezvitsky%2Fnodemon-golang-example%2Fmain%2Fpreview.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%2Fraw.githubusercontent.com%2FRezvitsky%2Fnodemon-golang-example%2Fmain%2Fpreview.png"&gt;&lt;/a&gt;
  &lt;br&gt;
&lt;/p&gt;



&lt;p&gt;&lt;strong&gt;Background&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Hey! When developing an application in the go language, it is necessary to restart it every time through the console in order to apply new changes, this is not convenient. I propose to sprinkle it. I will be using the npm nodemon package.&lt;/p&gt;

&lt;h1&gt;
  
  
  Start 🚀
&lt;/h1&gt;

&lt;p&gt;Install nodemon globally&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm install -g nodemon
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For easy launch of the application, I will create a Makefile.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;run: main.go
    nodemon --exec "go run" main.go
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Here to nodemon we pass the launch parameters and the application itself.&lt;/p&gt;



&lt;p&gt;To run the application&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;make run
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Example: &lt;a href="https://github.com/Rezvitsky/nodemon-golang-example" rel="noopener noreferrer"&gt;https://github.com/Rezvitsky/nodemon-golang-example&lt;/a&gt;&lt;/p&gt;

</description>
      <category>node</category>
      <category>go</category>
    </item>
    <item>
      <title>VRAT (Vitejs + Reactjs + Apollo + Tailwind CSS)</title>
      <dc:creator>Leonid Rezvitsky</dc:creator>
      <pubDate>Thu, 05 Aug 2021 12:36:10 +0000</pubDate>
      <link>https://dev.to/rezvitsky/vrat-vitejs-reactjs-apollo-tailwind-css-3ami</link>
      <guid>https://dev.to/rezvitsky/vrat-vitejs-reactjs-apollo-tailwind-css-3ami</guid>
      <description>&lt;p&gt;&lt;strong&gt;Background&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Hey! I want to share my stack I use, in it I collected:&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Vitejs&lt;/em&gt;&lt;br&gt;
&lt;em&gt;Reactjs&lt;/em&gt;&lt;br&gt;
&lt;em&gt;Apollo client&lt;/em&gt;&lt;br&gt;
&lt;em&gt;Tailwind CSS&lt;/em&gt;&lt;br&gt;
&lt;em&gt;Typescript&lt;/em&gt;&lt;br&gt;
&lt;em&gt;Routes&lt;/em&gt;&lt;br&gt;
&lt;em&gt;Light/Dark mode&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;I plan to update this stack in the future, I am waiting for ideas in the comments.🙂&lt;/p&gt;

&lt;p&gt;Repo: &lt;a href="https://github.com/Rezvitsky/vrat"&gt;https://github.com/Rezvitsky/vrat&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Apollo and Vuejs for Vitejs</title>
      <dc:creator>Leonid Rezvitsky</dc:creator>
      <pubDate>Sat, 30 Jan 2021 07:32:46 +0000</pubDate>
      <link>https://dev.to/rezvitsky/apollo-and-vuejs-for-vitejs-526j</link>
      <guid>https://dev.to/rezvitsky/apollo-and-vuejs-for-vitejs-526j</guid>
      <description>&lt;h1&gt;
  
  
  Apollo and Vuejs for Vitejs
&lt;/h1&gt;

&lt;p&gt;&lt;strong&gt;Background&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Hey! For me, it was necessary to use apollo-client with Vite 2. And while there are no clean libraries that will work only with Vuejs, then we will manage with what we have. The Apollo team wrote a client only for react and therefore we have to mess things up from: &lt;strong&gt;@apollo/client/core&lt;/strong&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Start 🚀
&lt;/h1&gt;

&lt;p&gt;First, we need to install the &lt;strong&gt;@apollo/client&lt;/strong&gt; package. This can be done with the command below:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm i @apollo/client // OR yarn add @apollo/client
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then I started setting up the configuration to work with the backend.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// src/apollo/client.js

import { ApolloClient, HttpLink } from '@apollo/client/core'
import { InMemoryCache } from '@apollo/client/cache'

const httpLink = new HttpLink({
  uri: import.meta.env.VITE_API_URL
})

const apolloClient = new ApolloClient({
  link: httpLink, 
  cache: new InMemoryCache()
})

export default apolloClient
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;p&gt;We can now import &lt;strong&gt;apollo.js&lt;/strong&gt; into the Vuejs component&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// src/components/ApolloHello.vue

&amp;lt;script setup&amp;gt;
import apolloClient from '../apollo/client.js'
import { EXCHANGE_RATES } from '../graphql'

const { data: { rates } } = await apolloClient.query({
  query: EXCHANGE_RATES
})

console.log(rates)
&amp;lt;/script&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;p&gt;You also need to make changes to &lt;strong&gt;vite.config.js&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
    ...
    optimizeDeps: {
        include: [
            '@apollo/client/core',
            '@apollo/client/cache'
        ]
    },
    rollupInputOptions: {
        external: ['react']
    }
    ...
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;h1&gt;
  
  
  What's next?
&lt;/h1&gt;

&lt;p&gt;We can now use &lt;strong&gt;@apollo/client&lt;/strong&gt; along with Vuejs. To try this stack, you can &lt;strong&gt;&lt;a href="https://github.com/Rezvitsky/vitejs-apollo"&gt;clone the repository&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>vue</category>
      <category>graphql</category>
      <category>apollo</category>
    </item>
  </channel>
</rss>
