Quantcast
Channel: Active questions tagged ruby - Stack Overflow
Viewing all articles
Browse latest Browse all 4609

Why is hot reloading not working in Vite + Rails?

$
0
0

I created a rails app, and installed vite_rails gem. My javascript is in app/frontend folder.

However, hot reloading when I save a JS file is not working.

I also tried by installing vite-plugin-full-reload NPM package. This is my config for vite:

// vite.config.jsimport { fileURLToPath, URL } from 'node:url'import { defineConfig } from 'vite'import FullReload from 'vite-plugin-full-reload'import RubyPlugin from 'vite-plugin-ruby'import vue from '@vitejs/plugin-vue'export default defineConfig({  plugins: [    RubyPlugin(),    vue(),    FullReload(['config/routes.rb', 'app/views/**/*', 'app/frontend/**/*']),  ],  resolve: {    alias: {'@': fileURLToPath(new URL('./app/frontend/internal', import.meta.url)),    },  },})

Docker config:

# docker-compose.ymlservices:  db:    image: postgres    env_file: .env.development  web:    image: rails    build: .    volumes:      - .:/app    ports:      - "3000:3000"    depends_on:      - db    env_file: .env.development
FROM ruby:3.3RUN apt-get update -qq && apt-get install -y build-essential apt-utils libpq-dev nodejs npmCOPY . /appWORKDIR /appRUN gem install bundler rails && bundleCMD rm tmp/pids/server.pid && rails s -b 0.0.0.0

Still not reloading, why?


Viewing all articles
Browse latest Browse all 4609

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>