How to set up : ViteJS + Local

Hi there :slight_smile:

I was wondering if someone succeeded to make ViteJS working with Local?

For now here is what I have:

import { defineConfig } from 'vite'

export default defineConfig({
   root: '../../../', // my vite.config.js is in my custom theme folder
   server: {
        host: 'mysite.local',
        open: true,
        proxy: {
          "/api": {
            target: "http://mysite.local",
            changeOrigin: true,
            secure: false,
            ws: true,
            rewrite: path => path.replace('/api', ''),
          },
        },
    },
})

Thanks in advance :slight_smile:

2 Likes

Any update on this? We’re also looking into setting up vite to compile JS and SCSS

If anyone is still interested in this I created a simple repo using TS & SCSS with Vite as a compiler. To build a custom WP theme. Hope it helps!

3 Likes

Thank you for sharing @milesaylward! :green_heart: