Update vite to v3

This commit is contained in:
Misode
2022-11-29 01:06:32 +01:00
parent 3e8a193e24
commit 60950c4e9a
7 changed files with 325 additions and 280 deletions

View File

@@ -1,5 +1,4 @@
import preact from '@preact/preset-vite'
import alias from '@rollup/plugin-alias'
import html from '@rollup/plugin-html'
import glob from 'fast-glob'
import fs from 'fs'
@@ -30,18 +29,21 @@ const guides = glob.sync('src/guides/**/*.md').flatMap(g => {
})
export default defineConfig({
server: {
port: 3000,
},
resolve: {
alias: [
{ find: 'react', replacement: 'preact/compat' },
{ find: 'react-dom/test-utils', replacement: 'preact/test-utils' },
{ find: 'react-dom', replacement: 'preact/compat' },
{ find: 'react/jsx-runtime', replacement: 'preact/jsx-runtime' },
],
},
build: {
sourcemap: true,
rollupOptions: {
plugins: [
alias({
entries: [
{ find: 'react', replacement: 'preact/compat' },
{ find: 'react-dom/test-utils', replacement: 'preact/test-utils' },
{ find: 'react-dom', replacement: 'preact/compat' },
{ find: 'react/jsx-runtime', replacement: 'preact/jsx-runtime' },
],
}),
html({
fileName: '404.html',
title: '404',