Skip to content

Commit

Permalink
test prod
Browse files Browse the repository at this point in the history
  • Loading branch information
popovvasile committed May 5, 2024
1 parent f714f5c commit 5c288df
Showing 1 changed file with 33 additions and 63 deletions.
96 changes: 33 additions & 63 deletions vite.config.js
Original file line number Diff line number Diff line change
@@ -1,66 +1,36 @@
import { defineConfig, loadEnv } from "vite";
import react from "@vitejs/plugin-react";
import { defineConfig, loadEnv } from 'vite';
import react from '@vitejs/plugin-react';
import compressionPlugin from 'vite-plugin-compression';

//https://vitejs.dev/config/#using-environment-variables-in-config
const env = loadEnv('','');
const api_url = JSON.stringify(env.VITE_API_URL);
export default defineConfig(({ mode }) => {
const env = loadEnv(mode, process.cwd());
const api_url = env.VITE_API_URL;


// https://vitejs.dev/config/
export default defineConfig({
plugins: [react()],
build: {
outDir: "build"
},
server: {
proxy: {
"/api": {
target: api_url,
changeOrigin: true,
},
}
},
test: {
globals: true,
environment: "jsdom",
setupFiles: "./test/setup.js",
passWithNoTests: true
},
return {
plugins: [
react(),
compressionPlugin({
disable: true, // Disable or configure appropriately
})
],
build: {
outDir: 'build',
sourcemap: true,
},
server: {
proxy: {
'/api/': {
target: api_url,
changeOrigin: true,
rewrite: path => path.replace(/^\/api/, ''),
},
}
},
test: {
globals: true,
environment: 'jsdom',
setupFiles: './test/setup.js',
passWithNoTests: true
},
};
});

// import { defineConfig, loadEnv } from 'vite';
// import react from '@vitejs/plugin-react';
// import compressionPlugin from 'vite-plugin-compression';
//
// export default defineConfig(({ mode }) => {
// const env = loadEnv(mode, process.cwd());
// const api_url = env.VITE_API_URL;
//
// return {
// plugins: [
// react(),
// compressionPlugin({
// disable: true, // Disable or configure appropriately
// })
// ],
// build: {
// outDir: 'build',
// sourcemap: true,
// },
// server: {
// proxy: {
// '/api/': {
// target: api_url,
// changeOrigin: true,
// rewrite: path => path.replace(/^\/api/, ''),
// },
// }
// },
// test: {
// globals: true,
// environment: 'jsdom',
// setupFiles: './test/setup.js',
// passWithNoTests: true
// },
// };
// });

0 comments on commit 5c288df

Please sign in to comment.