Geting error with build #4946
-
Hi Team, I am try to build a app using Vite and Inertia with React. In development mode my application is working fine, but when I try to run build version app its not working for me. my vite config is //import { sentryVitePlugin } from "@sentry/vite-plugin"; import { defineConfig } from 'vite' import adonisjs from '@adonisjs/vite/client' import inertia from '@adonisjs/inertia/client' import react from '@vitejs/plugin-react' export default defineConfig({ plugins: [ adonisjs({ //entrypoints: ['resources/css/app.css', 'resources/js/app.js','inertia/app/app.tsx','inertia/app/admin.tsx'], entrypoints: ['inertia/app/app.tsx','inertia/app/admin.tsx'], reload: ['resources/views/**/*.edge'], }), inertia({ ssr: { enabled: true, entrypoint: 'inertia/app/ssr.tsx' } }), react(), // sentryVitePlugin({ // org: "nxb-s3", // project: "nextbuying" // }) ], build: { outDir: 'public/assets', rollupOptions: { output: { entryFileNames: '[name].js', // Ensure the output files use .js extension chunkFileNames: '[name]-[hash].js', assetFileNames: '[name]-[hash].[ext]', }, }, sourcemap: true }, }) And my inertia config is import { defineConfig } from '@adonisjs/inertia' import type { InferSharedProps } from '@adonisjs/inertia/types' import type { HttpContext } from '@adonisjs/core/http' import env from '#start/env' const inertiaConfig = defineConfig({ /** * Path to the Edge view that will be used as the root view for Inertia responses */ //rootView: 'inertia_layout', rootView: ({ request }: HttpContext) => { if (request.url().startsWith('/admin')) { return 'admin_layout' } return 'web_layout' }, /** * Data that should be shared with all rendered pages */ sharedData: { appName: 'NXB Kart', appLogo: './new_logo.png', user: (ctx) => ctx.inertia.always(() => ctx.auth.user?.serialize()), customer: (ctx) => ctx.inertia.always(() => ctx.auth.use('customer').user?.serialize()), errors: (ctx) => ctx.session.flashMessages.get('errors'), url: (ctx) => ctx.inertia.always(() => env.get('APP_URL')+ctx.request.url()), flash: (ctx) => ctx.inertia.always(() => ctx.session.flashMessages.get('flash')), }, /** * Options for the server-side rendering */ ssr: { enabled: true, entrypoint: 'inertia/app/ssr.tsx' } }) export default inertiaConfig declare module '@adonisjs/inertia/types' { export interface SharedProps extends InferSharedProps {} } Please help me. |
Beta Was this translation helpful? Give feedback.
Answered by
RomainLanz
Jun 10, 2025
Replies: 1 comment 2 replies
-
Hey @pk4all! 👋🏻 It seems you are not running your application in production mode, you need to set the See https://docs.adonisjs.com/guides/views-and-templates/inertia#why-my-production-build-is-not-working- |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
pk4all
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey @pk4all! 👋🏻
It seems you are not running your application in production mode, you need to set the
NODE_ENV
variable toproduction
.See https://docs.adonisjs.com/guides/views-and-templates/inertia#why-my-production-build-is-not-working-