Skip to content

Instantly share code, notes, and snippets.

@zealot128
Created December 21, 2021 14:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zealot128/aadb277e80893601f7ddb63ef2cf2023 to your computer and use it in GitHub Desktop.
Save zealot128/aadb277e80893601f7ddb63ef2cf2023 to your computer and use it in GitHub Desktop.
Vite-rails + Inertia base setup
import { createApp, h } from 'vue'
import { createInertiaApp } from '@inertiajs/inertia-vue3'
import i18n from '~/utils/i18n'
createInertiaApp({
resolve: name => import(`/pages/${name}.vue`),
setup({ el, app, props, plugin }) {
createApp({ render: () => h(app, props) })
.use(plugin)
.use(i18n)
.mount(el)
},
})
import { defineConfig } from 'vite'
import RubyPlugin from 'vite-plugin-ruby' ? import FullReload from "vite-plugin-full-reload"
import vue from '@vitejs/plugin-vue'
import vueJsx from '@vitejs/plugin-vue-jsx'
export default defineConfig({
server: { hmr: {
host: process.env.VITE_WSS_HOST,
port: 443, protocol: 'wss',
},
},
plugins: [
RubyPlugin(),
vue({ ssr: false, isProduction: false}),
vueJsx({}),
FullReload(["config/routes.rb", "app/views/**/*", "app/controllers/**/*"], { delay: 200,
}),
],
})
{
"all": {
"sourceCodeDir": "app/javascript",
"watchAdditionalPaths": []
},
"development": {
"autoBuild": true,
"publicOutputDir": "vite-dev",
"port": 3036
},
"test": {
"autoBuild": true,
"publicOutputDir": "vite-test",
"port": 3037
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment