vite/playground/tailwind/vite.config.ts
2024-08-20 16:52:19 +09:00

43 lines
812 B
TypeScript

import { defineConfig } from 'vite'
import type { Plugin } from 'vite'
function delayIndexCssPlugin(): Plugin {
let server
return {
name: 'delay-index-css',
enforce: 'pre',
configureServer(_server) {
server = _server
},
async load(id) {
if (server && id.includes('index.css')) {
await server.waitForRequestsIdle(id)
}
},
}
}
export default defineConfig({
resolve: {
alias: {
'/@': __dirname,
},
},
build: {
// to make tests faster
minify: false,
},
plugins: [
{
name: 'delay view',
enforce: 'pre',
async transform(_code, id) {
if (id.includes('views/view1.js')) {
await new Promise((resolve) => setTimeout(resolve, 100))
}
},
},
delayIndexCssPlugin(),
],
})