PozoApp/vite.config.js

140 lines
3.7 KiB
JavaScript
Raw Normal View History

// import { defineConfig } from "vite";
// import react from "@vitejs/plugin-react";
// import sitemap from "vite-plugin-sitemap";
// export default defineConfig(({ mode }) => {
// const isProd = mode === "production";
// return {
// plugins: [
// react(),
// // Disabled vite-plugin-sitemap to use manual sitemap.xml
// // isProd &&
// // sitemap({
// // hostname: "https://www.pozo.app",
// // routes: ["/home/", "/home/signin", "/home/blog", "/home/contact-us", "/home/pricing-pozoapp", "/home/live-Session"],
// // }),
// ],
// base: "/home/",
// envDir: "src",
// envPrefix: "ENV_",
// build: {
// chunkSizeWarningLimit: 1000,
// rollupOptions: {
// output: {
// manualChunks: {
// vendor: ['react', 'react-dom'],
// editor: ['@editorjs/editorjs', '@editorjs/header', '@editorjs/image', '@editorjs/list', '@editorjs/paragraph', '@editorjs/code', '@editorjs/embed', '@editorjs/link', '@editorjs/quote'],
// ui: ['antd'],
// utils: ['axios', 'moment', 'crypto-js']
// }
// }
// },
// minify: 'terser',
// terserOptions: {
// compress: {
// drop_console: true,
// drop_debugger: true
// }
// }
// },
// server: {
// host: "localhost",
// port: process.env.PORT || 3000,
// },
// preview: {
// host: "localhost",
// port: 4173,
// },
// optimizeDeps: {
// exclude: ["console.log"],
// include: [
// "@editorjs/editorjs",
// "@editorjs/header",
// "@editorjs/image",
// "@editorjs/list",
// "@editorjs/paragraph",
// "@editorjs/code",
// "@editorjs/embed",
// "@editorjs/link",
// "@editorjs/quote",
// ],
// },
// };
// });
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import { terser } from "rollup-plugin-terser";
// https://vitejs.dev/config/
export default defineConfig(({ command, mode, ssrBuild }) => {
if (mode == "production") {
return {
plugins: [
react(),
// terser({ // Add terser plugin for production
// compress: {
// drop_console: true, // This removes all console.* statements
// },
// }),
],
base: "/home/",
envDir: "src",
envPrefix: "ENV_",
build: {
chunkSizeWarningLimit: 1000,
rollupOptions: {
output: {
manualChunks: {
vendor: ['react', 'react-dom'],
editor: ['@editorjs/editorjs', '@editorjs/header', '@editorjs/image', '@editorjs/list', '@editorjs/paragraph', '@editorjs/code', '@editorjs/embed', '@editorjs/link', '@editorjs/quote'],
ui: ['antd'],
utils: ['axios', 'moment', 'crypto-js']
}
}
},
minify: 'terser',
terserOptions: {
compress: {
drop_console: true,
drop_debugger: true
}
}
},
};
} else {
return {
plugins: [react()],
envDir: "src",
envPrefix: "ENV_",
server: {
host: "localhost",
port: process.env.PORT || 3000,
},
optimizeDeps: {
exclude: ["console.log"],
include: [
'@editorjs/editorjs',
'@editorjs/header',
'@editorjs/image',
'@editorjs/delimiter',
'@editorjs/list',
'@editorjs/paragraph'
]
},
};
}
});
// export default defineConfig({
// plugins: [react()],
// server: {
// host: '192.168.1.17',
// port: process.env.PORT || 3000,
// },
// });