forked from Light-it-labs/laravel
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.js
51 lines (44 loc) · 1.28 KB
/
vite.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import { sentryVitePlugin } from "@sentry/vite-plugin";
/* eslint-disable import/no-extraneous-dependencies */
import react from "@vitejs/plugin-react";
import laravel from "laravel-vite-plugin";
import { defineConfig, loadEnv } from "vite";
import checker from "vite-plugin-checker";
export default ({ mode }) => {
process.env = {...process.env, ...loadEnv(mode, process.cwd())};
const config = {
plugins: [
laravel({
input: ["resources/css/app.css", "resources/js/App.tsx"],
refresh: true,
}),
react(),
checker({ typescript: true }),
{
handleHotUpdate({ file, server }) {
if (file.endsWith(".blade.php")) {
server.ws.send({ path: "*", type: "full-reload" });
}
},
name: "blade",
},
],
build: {
sourcemap: true,
},
};
const env = process.env;
if (env) {
const sentryAuthToken = env.VITE_SENTRY_AUTH_TOKEN;
const sentryOrg = env.VITE_SENTRY_ORGANIZATION;
const sentryProject = env.VITE_SENTRY_PROJECT;
if (sentryAuthToken && sentryOrg && sentryProject) {
config.plugins.push(sentryVitePlugin({
authToken: sentryAuthToken,
org: sentryOrg,
project: sentryProject,
}));
}
}
return defineConfig(config);
}