Ich habe npm in einem anderen Dienst ausgeführt, dieser wird nur bei Bedarf ausgeführt und wenn ich npm run dev ausführe, startet der Vite-Entwicklungsserver, was großartig ist, aber ich finde, dass er nichts bemerkt.
meine Docker-Compose-Datei ist:
Code: Select all
ervices:
nginx:
#image: nginx:stable-apline
build:
context: .
ports:
- 80:80
volumes:
- ./src:/var/www/html
depends_on:
- mysql
- php
mysql:
image: mariadb:10.5.8
ports:
- 3306:3306
environment:
MYSQL_DATABASE: laravel
MYSQL_USER: laravel
MYSQL_PASSWORD: secret
MYSQL_ROOT_PASSWORD: secret
volumes:
- ./mysql:/var/lib/mysql
php:
build:
context: .
dockerfile: php.dockerfile
volumes:
- ./src:/var/www/html
composer:
build:
context: .
dockerfile: composer.dockerfile
volumes:
- ./src:/var/www/html
working_dir: /var/www/html
node:
image: node:current-alpine
volumes:
- ./src:/var/www/html
entrypoint: ["npm"]
working_dir: /var/www/html

Meine Vite-Konfiguration lautet wie folgt:
Code: Select all
import { defineConfig } from 'vite';
import laravel from 'laravel-vite-plugin';
import tailwindcss from '@tailwindcss/vite';
import vue from '@vitejs/plugin-vue';
export default defineConfig({
server: {
strictPort: true,
port: 5173,
host: '127.0.0.1',
origin: 'http://localhost:5173',
hmr: {
host: 'localhost',
},
watch: {
usePolling: true
}
},
plugins: [
laravel({
input: ['resources/css/app.css', 'resources/js/app.js'],
refresh: true,
}),
tailwindcss(),
vue()
]
});
Code: Select all
{{ config('app.name', 'Laravel') }}
@vite(['resources/css/app.css', 'resources/js/app.js'])
Code: Select all
import './bootstrap';
import {createApp} from "vue/dist/vue.esm-bundler.js";
import HomeComponent from "./components/HomeComponent.vue";
const app = createApp({});
app.component('HomeComponent', HomeComponent);
app.mount('#app');
Irgendwelche Gedanken?
Mobile version