-
-
Save cjholowatyj/a0bca07aaef09b4bc5d56c83280159d0 to your computer and use it in GitHub Desktop.
Laravel 10 / InertiaJS 1 / VueJS 3 / ViteJS 4 - A Working Configuration?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"private": true, | |
"name": "keddy-ca", | |
"version": "1.0.0", | |
"description": "The primary website project for Keddy Digital, built on the Flighter framework.", | |
"main": "resources/js/app.js", | |
"scripts": { | |
"dev": "vite --host keddy.test --open --cors --force", | |
"build:dev": "npm run da-all && npm run da-zig-generate && rm -rf ./public/build/ && vite build --mode development && vite build --ssr --mode development", | |
"env-dev": "APP_ENV=local APP_URL=https://keddy.test TELESCOPE_DOMAIN=telescope.keddy.test", | |
"da-all": "npm run env-dev && npm run da-clr-cache && npm run da-clr-route && npm run da-clr-config && npm run da-clr-view && npm run da-opt", | |
"da-clr-cache": "APP_ENV=local APP_URL=https://keddy.test TELESCOPE_DOMAIN=telescope.keddy.test && php artisan cache:clear", | |
"da-clr-config": "APP_ENV=local APP_URL=https://keddy.test TELESCOPE_DOMAIN=telescope.keddy.test && php artisan config:clear", | |
"da-clr-route": "APP_ENV=local APP_URL=https://keddy.test TELESCOPE_DOMAIN=telescope.keddy.test && php artisan route:clear", | |
"da-clr-view": "APP_ENV=local APP_URL=https://keddy.test TELESCOPE_DOMAIN=telescope.keddy.test && php artisan view:clear", | |
"da-mig-fresh": "APP_ENV=local APP_URL=https://keddy.test TELESCOPE_DOMAIN=telescope.keddy.test && php artisan migrate:fresh", | |
"da-oct-reload": "APP_ENV=local APP_URL=https://keddy.test TELESCOPE_DOMAIN=telescope.keddy.test && php artisan octane:reload", | |
"da-opt": "APP_ENV=local APP_URL=https://keddy.test TELESCOPE_DOMAIN=telescope.keddy.test && php artisan optimize", | |
"da-zig-generate": "APP_ENV=local APP_URL=https://keddy.test TELESCOPE_DOMAIN=telescope.keddy.test && php artisan ziggy:generate", | |
"prod": "vite --host keddy.ca --open --cors --force", | |
"build:prod": "npm run pa-all && npm run pa-zig-generate && rm -rf ./public/build/ && vite build && vite build --ssr", | |
"env-prod": "APP_ENV=production APP_URL=https://keddy.ca TELESCOPE_DOMAIN=telescope.keddy.ca", | |
"pa-all": "npm run env-prod && npm run pa-clr-cache && npm run pa-clr-route && npm run pa-clr-config && npm run pa-clr-view && npm run pa-opt", | |
"pa-clr-cache": "APP_ENV=production APP_URL=https://keddy.ca TELESCOPE_DOMAIN=telescope.keddy.ca && php artisan cache:clear", | |
"pa-clr-config": "APP_ENV=production APP_URL=https://keddy.ca TELESCOPE_DOMAIN=telescope.keddy.ca && php artisan config:clear", | |
"pa-clr-route": "APP_ENV=production APP_URL=https://keddy.ca TELESCOPE_DOMAIN=telescope.keddy.ca && php artisan route:clear", | |
"pa-clr-view": "APP_ENV=production APP_URL=https://keddy.ca TELESCOPE_DOMAIN=telescope.keddy.ca && php artisan view:clear", | |
"pa-mig-fresh": "APP_ENV=production APP_URL=https://keddy.ca TELESCOPE_DOMAIN=telescope.keddy.ca && php artisan migrate:fresh", | |
"pa-oct-reload": "APP_ENV=production APP_URL=https://keddy.ca TELESCOPE_DOMAIN=telescope.keddy.ca && php artisan octane:reload", | |
"pa-opt": "APP_ENV=production APP_URL=https://keddy.ca TELESCOPE_DOMAIN=telescope.keddy.ca && php artisan optimize", | |
"pa-zig-generate": "APP_ENV=production APP_URL=https://keddy.ca TELESCOPE_DOMAIN=telescope.keddy.ca && php artisan ziggy:generate", | |
"docs:build": "vitepress build docs", | |
"docs:dev": "vitepress dev docs", | |
"docs:preview": "vitepress preview docs", | |
"preview": "vite preview", | |
"redis-flush": "redis-cli flushall" | |
}, | |
"repository": { | |
"type": "git", | |
"url": "https://git.jetbrains.space/keddy/flighter/flighter-base.git" | |
}, | |
"author": "Chris Holowatyj <chris@keddy.ca>", | |
"license": "ISC", | |
"dependencies": { | |
"@bugsnag/js": "^7.20.0", | |
"@bugsnag/plugin-vue": "^7.19.0", | |
"@fortawesome/fontawesome-svg-core": "^6.3.0", | |
"@fortawesome/pro-duotone-svg-icons": "^6.3.0", | |
"@fortawesome/vue-fontawesome": "^3.0.3", | |
"@imgix/vue": "^3.0.4", | |
"@inertiajs/vue3": "^1.0.5", | |
"@tailwindcss/aspect-ratio": "^0.4.2", | |
"@tailwindcss/forms": "^0.5.3", | |
"@tailwindcss/typography": "^0.5.9", | |
"@vitejs/plugin-vue": "^4.0.0", | |
"@vue/server-renderer": "^3.3.2", | |
"alpinejs": "^3.11.1", | |
"autoprefixer": "^10.4.13", | |
"axios": "^1.3.2", | |
"chokidar": "^3.5.3", | |
"dotenv": "^16.0.3", | |
"git-describe": "^4.1.1", | |
"laravel-vite-plugin": "^0.7.3", | |
"lightningcss": "^1.18.0", | |
"lodash": "^4.17.21", | |
"markdown-it-anchor": "^8.6.7", | |
"md5": "^2.3.0", | |
"moment": "^2.29.4", | |
"pinia": "^2.0.33", | |
"postcss": "^8.4.21", | |
"tailwindcss": "^3.2.4", | |
"vite": "^4.1.1", | |
"vite-plugin-compression": "^0.5.1", | |
"vite-plugin-dynamic-import": "^1.2.7", | |
"vue": "^3.3.0", | |
"vue-filepond": "^7.0.3", | |
"vue-imgix": "github:KeddyAssociates/vue-imgix#next", | |
"vue-moment": "^4.1.0", | |
"vue-select": "^4.0.0-beta.5", | |
"vue3-markdown-it": "^1.0.10", | |
"vue3-popper": "^1.5.0", | |
"vuestic-ui": "^1.6.1", | |
"ziggy-js": "^1.5.0" | |
}, | |
"devDependencies": { | |
"material-design-icons-iconfont": "^6.7.0", | |
"sass": "^1.58.0", | |
"vitepress": "^1.0.0-alpha.47" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import './bootstrap'; | |
import '../css/app.css'; | |
/* BUGSNAG DEPENDENCIES */ | |
import Bugsnag from '@bugsnag/js'; | |
import BugsnagPluginVue from '@bugsnag/plugin-vue'; | |
/* FLIGHTER DEPENDENCIES */ | |
import Flighter from '../../flighter/resources/js/flighter'; | |
/* FONTAWESOME DEPENDENCIES */ | |
import {library} from '@fortawesome/fontawesome-svg-core'; | |
import {FontAwesomeIcon} from '@fortawesome/vue-fontawesome'; | |
/* IMGIX DEPENDENCIES */ | |
import VueImgix from '@imgix/vue'; | |
/* INERTIA DEPENDENCIES */ | |
import {createInertiaApp,Head,Link} from '@inertiajs/vue3'; | |
/* MARKDOWNIT DEPENDENCIES */ | |
import Markdown from 'vue3-markdown-it'; | |
/* PINIA DEPENDENCIES */ | |
import {createPinia} from 'pinia'; | |
/* VUE DEPENDENCIES */ | |
import {createApp,h} from 'vue/dist/vue.esm-bundler'; | |
/* VUESELECT DEPENDENCIES */ | |
import vSelect from 'vue-select'; | |
/* VUESTIC DEPENDENCIES */ | |
import {createVuestic} from "vuestic-ui"; | |
import "vuestic-ui/css"; | |
import "material-design-icons-iconfont/dist/material-design-icons.min.css"; | |
/* ZIGGY DEPENDENCIES */ | |
import route from 'ziggy-js'; | |
import {useAppStore} from '%/stores/AppStore.js'; | |
/* BUGSNAG INITIALIZATION */ | |
Bugsnag.start({ | |
apiKey:import.meta.env.VITE_BUGSNAG_API_KEY, | |
plugins:[new BugsnagPluginVue()], | |
releaseStage:import.meta.env.VITE_APP_ENV, | |
appVersion:import.meta.env.VITE_APP_GIT_HASH, | |
otherOptions:[] | |
}); | |
const bugsnagVue=Bugsnag.getPlugin('vue'); | |
/* FONTAWESOME INITIALIZATION */ | |
/* @formatter:off */ | |
import { | |
faArrowRotateLeft,faArrowUpRightFromSquare,faBars,faCalendarCirclePlus,faCalendarCircleUser,faCalendarClock,faCaretDown,faCaretUp,faChartNetwork, | |
faChurch,faCircle,faCircleCheck,faCircleDollar,faCircleEllipsis,faCircleInfo,faCircleQuestion,faCircleXmark,faCity,faCloudCheck,faEllipsis, | |
faEnvelope,faFilter,faFilterCircleXmark,faMagnifyingGlass,faMars,faMarsAndVenus,faPeopleGroup,faPersonThroughWindow,faPhone,faPlus,faRotate, | |
faSchool,faSignature,faSignatureLock,faSignatureSlash,faStar,faTriangleExclamation,faUniversalAccess,faUser,faUserVneckHair,faUserVneckHairLong, | |
faVenus,faVolleyballBall,faXmark | |
} from '@fortawesome/pro-duotone-svg-icons'; | |
library.add( | |
faArrowRotateLeft,faArrowUpRightFromSquare,faBars,faCalendarCirclePlus,faCalendarCircleUser,faCalendarClock,faCaretDown,faCaretUp,faChartNetwork, | |
faChurch,faCircle,faCircleCheck,faCircleDollar,faCircleEllipsis,faCircleInfo,faCircleQuestion,faCircleXmark,faCity,faCloudCheck,faEllipsis, | |
faEnvelope,faFilter,faFilterCircleXmark,faMagnifyingGlass,faMars,faMarsAndVenus,faPeopleGroup,faPersonThroughWindow,faPhone,faPlus,faRotate, | |
faSchool,faSignature,faStar,faTriangleExclamation,faUniversalAccess,faUser,faUserVneckHair,faSignatureLock,faSignatureSlash,faUserVneckHairLong, | |
faVenus,faVolleyballBall,faXmark | |
); | |
/* @formatter:on */ | |
/* PINIA INITIALIZATION */ | |
const pinia=createPinia(); | |
/* VUE INITIALIZATION */ | |
createInertiaApp({ | |
title:(title)=>`${title}`, | |
resolve:async(name)=>(await import(/* @vite-ignore */name.startsWith('flighter::')? | |
`../../flighter/resources/js/pages/${name.substring(10)}.vue`: | |
`./pages/${name}.vue`)).default, | |
setup({el,App,props,plugin}){ | |
let appCreated=createApp({render:()=>h(App,props)}).use(plugin).mixin({methods:{route}}) | |
/* @formatter:off */ | |
/* FONTAWESOME COMPONENTS */.component('FontAwesomeIcon',FontAwesomeIcon) | |
/* INERTIA COMPONENTS */.component('InertiaLink',Link).component('InertiaHead',Head) | |
/* VUESELECT COMPONENTS */.component('VueSelect',vSelect) | |
/* BUGSNAG USAGE */.use(bugsnagVue) | |
/* FLIGHTER USAGE */.use(Flighter) | |
/* IMGIX USAGE */.use(VueImgix,{domain:import.meta.env.VITE_IMGIX_DOMAIN,secureURLToken:import.meta.env.VITE_IMGIX_API_KEY,useHTTPS:true,defaultIxParams:{}}) | |
/* MARKDOWNIT USAGE */.use(Markdown) | |
/* PINIA USAGE */.use(pinia) | |
/* VUESTIC USAGE */.use(createVuestic()); | |
appCreated.config.devtools=true; | |
const appStore=useAppStore(); | |
appStore.$patch({ | |
admin:props.initialPage.props.app.admin??null, | |
csrf:props.initialPage.props.app.csrf??null, | |
components:props.initialPage.props.app.components??null, | |
console_logging:props.initialPage.props.app.console_logging??null, | |
env:props.initialPage.props.app.env??null, | |
errors:props.initialPage.props.app.errors??null, | |
jetstream:props.initialPage.props.app.jetstream??null, | |
settings:props.initialPage.props.app.settings??null, | |
status:props.initialPage.props.app.status??null, | |
user:props.initialPage.props.app.user??null, | |
ziggy:props.initialPage.props.app.ziggy??null, | |
}) | |
appCreated.mount(el); | |
return appCreated; | |
/* @formatter:on */ | |
}, | |
progress:{color:'#4fb4d3'} | |
}).then(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import './bootstrap'; | |
import '../css/app.css'; | |
/* BUGSNAG DEPENDENCIES */ | |
import Bugsnag from '@bugsnag/js'; | |
import BugsnagPluginVue from '@bugsnag/plugin-vue'; | |
/* FLIGHTER DEPENDENCIES */ | |
import Flighter from '../../flighter/resources/js/flighter'; | |
/* FONTAWESOME DEPENDENCIES */ | |
import {library} from '@fortawesome/fontawesome-svg-core'; | |
import {FontAwesomeIcon} from '@fortawesome/vue-fontawesome'; | |
/* IMGIX DEPENDENCIES */ | |
import VueImgix from '@imgix/vue'; | |
/* INERTIA DEPENDENCIES */ | |
import {createInertiaApp,Head,Link} from '@inertiajs/vue3'; | |
/* MARKDOWNIT DEPENDENCIES */ | |
import Markdown from 'vue3-markdown-it'; | |
/* PINIA DEPENDENCIES */ | |
import {createPinia} from 'pinia'; | |
/* VUE DEPENDENCIES */ | |
import {createApp,createSSRApp,h} from 'vue'; | |
/* VUESELECT DEPENDENCIES */ | |
import vSelect from 'vue-select'; | |
/* VUESTIC DEPENDENCIES */ | |
import {createVuestic} from "vuestic-ui"; | |
import "vuestic-ui/css"; | |
import "material-design-icons-iconfont/dist/material-design-icons.min.css"; | |
/* ZIGGY DEPENDENCIES */ | |
import route from 'ziggy-js'; | |
import createServer from '@inertiajs/vue3/server' | |
import {renderToString} from '@vue/server-renderer' | |
import {useAppStore} from '%/stores/AppStore.js'; | |
/* BUGSNAG INITIALIZATION */ | |
Bugsnag.start({ | |
apiKey:import.meta.env.VITE_BUGSNAG_API_KEY, | |
plugins:[new BugsnagPluginVue()], | |
releaseStage:import.meta.env.VITE_APP_ENV, | |
appVersion:import.meta.env.VITE_APP_GIT_HASH, | |
otherOptions:[] | |
}); | |
const bugsnagVue=Bugsnag.getPlugin('vue'); | |
/* FONTAWESOME INITIALIZATION */ | |
/* @formatter:off */ | |
import { | |
faArrowRotateLeft,faArrowUpRightFromSquare,faBars,faCalendarCirclePlus,faCalendarCircleUser,faCalendarClock,faCaretDown,faCaretUp,faChartNetwork, | |
faChurch,faCircle,faCircleCheck,faCircleDollar,faCircleEllipsis,faCircleInfo,faCircleQuestion,faCircleXmark,faCity,faCloudCheck,faEllipsis, | |
faEnvelope,faFilter,faFilterCircleXmark,faMagnifyingGlass,faMars,faMarsAndVenus,faPeopleGroup,faPersonThroughWindow,faPhone,faPlus,faRotate, | |
faSchool,faSignature,faSignatureLock,faSignatureSlash,faStar,faTriangleExclamation,faUniversalAccess,faUser,faUserVneckHair,faUserVneckHairLong, | |
faVenus,faVolleyballBall,faXmark | |
} from '@fortawesome/pro-duotone-svg-icons'; | |
library.add( | |
faArrowRotateLeft,faArrowUpRightFromSquare,faBars,faCalendarCirclePlus,faCalendarCircleUser,faCalendarClock,faCaretDown,faCaretUp,faChartNetwork, | |
faChurch,faCircle,faCircleCheck,faCircleDollar,faCircleEllipsis,faCircleInfo,faCircleQuestion,faCircleXmark,faCity,faCloudCheck,faEllipsis, | |
faEnvelope,faFilter,faFilterCircleXmark,faMagnifyingGlass,faMars,faMarsAndVenus,faPeopleGroup,faPersonThroughWindow,faPhone,faPlus,faRotate, | |
faSchool,faSignature,faStar,faTriangleExclamation,faUniversalAccess,faUser,faUserVneckHair,faSignatureLock,faSignatureSlash,faUserVneckHairLong, | |
faVenus,faVolleyballBall,faXmark | |
); | |
/* @formatter:on */ | |
/* PINIA INITIALIZATION */ | |
const pinia=createPinia(); | |
/* VUE SSR INITIALIZATION */ | |
createServer(page=> | |
createInertiaApp({ | |
page, | |
title:(title)=>`${title}`, | |
render:renderToString, | |
resolve:async(name)=>(await import(/* @vite-ignore */name.startsWith('flighter::')? | |
`../../flighter/resources/js/pages/${name.substring(10)}.vue`: | |
`./pages/${name}.vue`)).default, | |
setup({App,props,plugin}){ | |
let appCreated=createSSRApp({render:()=>h(App,props)}).use(plugin).mixin({methods:{route}}) | |
/* @formatter:off */ | |
/* FONTAWESOME COMPONENTS */.component('FontAwesomeIcon',FontAwesomeIcon) | |
/* INERTIA COMPONENTS */.component('InertiaLink',Link).component('InertiaHead',Head) | |
/* VUESELECT COMPONENTS */.component('VueSelect',vSelect) | |
/* BUGSNAG USAGE */.use(bugsnagVue) | |
/* FLIGHTER USAGE */.use(Flighter) | |
/* IMGIX USAGE */.use(VueImgix,{domain:import.meta.env.VITE_IMGIX_DOMAIN,secureURLToken:import.meta.env.VITE_IMGIX_API_KEY,useHTTPS:true,defaultIxParams:{}}) | |
/* MARKDOWNIT USAGE */.use(Markdown) | |
/* PINIA USAGE */.use(pinia) | |
/* VUESTIC USAGE */.use(createVuestic()); | |
appCreated.config.devtools=true; | |
const appStore=useAppStore(); | |
appStore.$patch({ | |
admin:props.initialPage.props.app.admin??null, | |
csrf:props.initialPage.props.app.csrf??null, | |
components:props.initialPage.props.app.components??null, | |
console_logging:props.initialPage.props.app.console_logging??null, | |
env:props.initialPage.props.app.env??null, | |
errors:props.initialPage.props.app.errors??null, | |
jetstream:props.initialPage.props.app.jetstream??null, | |
settings:props.initialPage.props.app.settings??null, | |
status:props.initialPage.props.app.status??null, | |
user:props.initialPage.props.app.user??null, | |
ziggy:props.initialPage.props.app.ziggy??null, | |
}) | |
return appCreated; | |
/* @formatter:on */ | |
}, | |
}), | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@php | |
try { | |
$ssr=Http::post('http://localhost:8080/render',$page)->throw()->json(); | |
} catch (Exception $e) { | |
$ssr=null; | |
} | |
@endphp | |
<!DOCTYPE html> | |
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}"> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
@routes | |
@vite(['resources/js/app.js'/*,'resources/css/app.css'*/],'build') | |
@inertiaHead | |
</head> | |
<body class="font-sans antialiased is-preload m-0 p-0 overflow-x-hidden" style="-ms-overflow-x:hidden!important;overflow-x:hidden!important"> | |
@inertia | |
<div class="fixed inset-0 top-0 bottom-0 left-0 right-0 bg-gray-100 -z-50"></div> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {resolve} from "path"; | |
import laravel from 'laravel-vite-plugin'; | |
import vue from '@vitejs/plugin-vue'; | |
import {defineConfig} from 'vite' | |
import dynamicImport from 'vite-plugin-dynamic-import'; | |
import {gitDescribeSync} from 'git-describe'; | |
import viteCompression from 'vite-plugin-compression'; | |
import * as dotenv from 'dotenv'; | |
dotenv.config(); | |
process.env.VITE_APP_GIT_HASH=gitDescribeSync().hash; | |
/* @formatter:off */ | |
/** @type {import('vite').UserConfig} */ | |
export default defineConfig({ | |
base:'/build', | |
publicPath:'public', | |
build:{ | |
chunkSizeWarningLimit:'2M', | |
manifest:true, | |
outDir:'public/build', | |
assetsDir:'assets', | |
rollupOptions:{ | |
input:'resources/js/app.js', | |
sourcemap:true, | |
external:['fsevents'], | |
output:{ | |
compact:true, | |
manualChunks(id){ | |
if(id.includes('vuestic')) return 'vuestic'; | |
if(id.includes('@vue')) return 'vue'; | |
if(id.includes('vue')) return 'vue2'; | |
if(id.includes('@bugsnag')) return 'bugsnag'; | |
if(id.includes('@fortawesome')) return 'fortawesome'; | |
if(id.includes('@inertia')||id.includes('nprogress')||id.includes('pinia')) return 'inertia'; | |
if(id.includes('@imgix')) return 'imgix'; | |
if(id.includes('material')) return 'material'; | |
if(id.includes('node_modules')) return 'vendor'; | |
} | |
}, | |
}, | |
}, | |
plugins:[ | |
dynamicImport, | |
laravel({input:'resources/js/app.js',ssr:'resources/js/ssr.js',refresh:true,valetTls:process.env.VITE_APP_HOST}), | |
{ | |
name:'blade', | |
handleHotUpdate({file,server}){ | |
if(file.endsWith('.blade.php')){server.ws.send({type:'full-reload',path:'*'});} | |
}, | |
}, | |
vue({template:{transformAssetUrls:{base:null,includeAbsolute:false}}}), | |
viteCompression({ | |
exclude: ["ssr-manifest.json"] | |
}) | |
], | |
resolve:{alias:{'@':resolve('/resources/js'),'%':resolve('/flighter/resources/js/components')},mainFields:[]}, | |
/* @formatter:on */ | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment