Skip to content

Instantly share code, notes, and snippets.

@rvibit
Created February 4, 2023 13:03
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
vite.config.js for laravel-shopify react SPA
import { defineConfig, loadEnv } from "vite";
import laravel from "laravel-vite-plugin";
import react from "@vitejs/plugin-react";
import fs from "node:fs";
export default defineConfig(function ({ mode }) {
process.env = { ...process.env, ...loadEnv(mode, process.cwd()) }; //process.env is not accessible directly in this file so we have to do this
return {
plugins: [
laravel(["resources/css/app.css", "resources/js/app.js"]),
react(),
],
define: {
"process.env.SHOPIFY_API_KEY": JSON.stringify(
process.env.VITE_SHOPIFY_API_KEY
),
},
resolve: {
preserveSymlinks: true,
},
server: {
host: "localhost",
//below section is for SSL , if you are using self signed certificates for ssl on localhost you can map them here or remove this section
https: {
key: fs.readFileSync("../../etc/ssl/laragon.key"),
cert: fs.readFileSync("../../etc/ssl/laragon.crt"),
},
},
};
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment