vite.config.js 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. import { defineConfig, loadEnv } from "vite";
  2. import vue from "@vitejs/plugin-vue";
  3. import laravel from "laravel-vite-plugin";
  4. import path from "path";
  5. export default defineConfig(({ mode }) => {
  6. const envDir = "../../../";
  7. Object.assign(process.env, loadEnv(mode, envDir));
  8. return {
  9. build: {
  10. emptyOutDir: true,
  11. minify: "esbuild",
  12. cssCodeSplit: true,
  13. rollupOptions: {
  14. output: {
  15. manualChunks: {
  16. vue: ["vue"],
  17. veeValidate: ["vee-validate", "@vee-validate/rules", "@vee-validate/i18n"],
  18. vendor: ["axios", "mitt"]
  19. }
  20. }
  21. }
  22. },
  23. envDir,
  24. server: {
  25. host: process.env.VITE_HOST || "localhost",
  26. port: process.env.VITE_PORT || 5173,
  27. cors: true,
  28. },
  29. plugins: [
  30. vue(),
  31. laravel({
  32. hotFile: "../../../public/shop-default-vite.hot",
  33. publicDirectory: "../../../public",
  34. buildDirectory: "themes/shop/default/build",
  35. input: [
  36. "src/Resources/assets/css/app.css",
  37. "src/Resources/assets/js/app.js",
  38. ],
  39. refresh: true,
  40. preload: false,
  41. }),
  42. ],
  43. experimental: {
  44. renderBuiltUrl(filename, { hostId, hostType, type }) {
  45. if (hostType === "css") {
  46. return path.basename(filename);
  47. }
  48. },
  49. },
  50. };
  51. });