Skip to content

Instantly share code, notes, and snippets.

@terrylinooo
Created September 29, 2023 15:22
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 terrylinooo/767fb9991afe3fa869bc02bdd913c197 to your computer and use it in GitHub Desktop.
Save terrylinooo/767fb9991afe3fa869bc02bdd913c197 to your computer and use it in GitHub Desktop.
vite.config.js
import { defineConfig } from 'vite'
import liveReload from 'vite-plugin-live-reload'
const { resolve } = require('path')
export default defineConfig({
plugins: [
liveReload(__dirname + '/**/*.php')
],
root: '',
base: process.env.NODE_ENV === 'development'
? '/'
: '/dist/',
build: {
outDir: resolve(__dirname, './dist'),
emptyOutDir: true,
manifest: true,
target: 'es2018',
rollupOptions: {
input: {
main: resolve(__dirname, './assets/src/main.js')
},
output: {
entryFileNames: `[name].js`,
chunkFileNames: `[name].js`,
assetFileNames: `[name].[ext]`
}
},
minify: true,
write: true
},
server: {
cors: true,
strictPort: true,
port: 3000,
https: false,
hmr: {
host: '127.0.0.1',
},
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment