Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use on prod #28

Open
Lehj14 opened this issue May 17, 2024 · 0 comments
Open

How to use on prod #28

Lehj14 opened this issue May 17, 2024 · 0 comments

Comments

@Lehj14
Copy link

Lehj14 commented May 17, 2024

Hi, I am trying to use this on my docker prod. When I use it on my dev and follow https://symfony-vite.pentatrion.com/guide/installation.html and do npm run dev it all works fine. But on prod, I did npm run build and it did not work (i did not get all my CSS and images) ,while on prod do I still need to run npm run dev?

I also get /img/professionals/prof-banner-one.jpg referenced in /var/www/html/assets/app.css didn't resolve at build time, it will remain unchanged to be resolved at runtime when I run npm run build

my config:

import symfonyPlugin from "vite-plugin-symfony";

/* if you're using React */
// import react from '@vitejs/plugin-react';

export default defineConfig({
    plugins: [
        /* react(), // if you're using React */
        symfonyPlugin({
            viteDevServerHostname: 'localhost',
        }),
    ],
    build: {
        rollupOptions: {
            input: {
                app: "./assets/app.js",
            },
        },
        assetsInlineLimit: 0
    },
    server: {
        host: '0.0.0.0',
        // hmr: {
        //     protocol: "ws"
        // }
    }
});

and docker-compose for prod

      image: node:21-alpine
      user: "${UID}:${GID}"
      working_dir: /var/www/html
      volumes:
        - ./:/var/www/html
      command: sh -c "npm install && npm run build"

It's my first time using this so I appreciate any help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant