Created
February 4, 2023 13:03
-
-
Save rvibit/a32c673a54034fc1206fe80d7ac389f9 to your computer and use it in GitHub Desktop.
vite.config.js for laravel-shopify react SPA
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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