Fix: Rename vite.config.js to .mjs in all packages
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 3m20s

This ensures that Vite treats the configuration files as ESM, allowing them to
natively import 'laravel-vite-plugin' (which is ESM-only). This resolves the
build error where esbuild was converting imports to require() calls in CJS packages,
causing the build to fail.
This commit is contained in:
Cauê Faleiros
2026-02-04 12:06:21 -03:00
parent 2d12674d63
commit 9deea35c70
3 changed files with 0 additions and 0 deletions

View File

@@ -0,0 +1,46 @@
import { defineConfig, loadEnv } from "vite";
import vue from "@vitejs/plugin-vue";
import laravel from "laravel-vite-plugin";
import path from "path";
export default defineConfig(({ mode }) => {
const envDir = "../../../";
Object.assign(process.env, loadEnv(mode, envDir));
return {
build: {
emptyOutDir: true,
},
envDir,
server: {
host: process.env.VITE_HOST || "localhost",
port: process.env.VITE_PORT || 5174,
},
plugins: [
vue(),
laravel({
hotFile: "../../../public/webform-vite.hot",
publicDirectory: "../../../public",
buildDirectory: "webform/build",
input: [
"src/Resources/assets/css/app.css",
"src/Resources/assets/js/app.js",
],
refresh: true,
}),
],
experimental: {
renderBuiltUrl(filename, { hostId, hostType, type }) {
if (hostType === "css") {
return path.basename(filename);
}
},
},
};
});