composer require oblik/kirby-vite
npm i
composer require oblik/kirby-vite
npm i
{ | |
"devDependencies": { | |
"vite": "^4.0.4" | |
}, | |
"scripts": { | |
"dev": "rm -rf dist && vite", | |
"build": "vite build" | |
}, | |
"dependencies": { | |
"sass": "^1.57.1", | |
"vite-plugin-live-reload": "^3.0.1" | |
} | |
} |
import { defineConfig } from 'vite' | |
import path from 'path'; | |
import liveReload from 'vite-plugin-live-reload' | |
let reloadDirs = [ | |
'content/**/*.txt', | |
'site/(templates|snippets|controllers|models|plugins)/**/*.php', | |
] | |
export default ({ mode }) => defineConfig({ | |
plugins: [ | |
liveReload(reloadDirs) | |
], | |
server: { | |
host: path.basename(__dirname) + '.test' | |
}, | |
// config | |
// base: mode === 'development' ? '/' : '/dist', | |
build: { | |
// output dir for production build | |
outDir: './dist', | |
// emit manifest so PHP can find the hashed files | |
manifest: true, | |
// our entry | |
rollupOptions: { | |
input: 'assets/js/main.js', | |
}, | |
resolve: { | |
alias: { | |
'@': '/assets/js/components', | |
} | |
} | |
} | |
}) |