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 c91633b commit f714f5c
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 37 deletions.
5 changes: 1 addition & 4 deletions config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
const one_day = 1440;
import { loadEnv } from 'vite';

const env = loadEnv(process.cwd());
const api_url = env.VITE_API_URL;
const api_url = import.meta.env.VITE_API_URL;

const config = {
title: "Project Mariupol",
Expand Down
96 changes: 63 additions & 33 deletions vite.config.js
Original file line number Diff line number Diff line change
@@ -1,36 +1,66 @@
import { defineConfig, loadEnv } from 'vite';
import react from '@vitejs/plugin-react';
import compressionPlugin from 'vite-plugin-compression';
import { defineConfig, loadEnv } from "vite";
import react from "@vitejs/plugin-react";

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

// 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
},
});

// 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 f714f5c

Please sign in to comment.