napi-rs/examples/napi/vite.config.js

35 lines
829 B
JavaScript
Raw Permalink Normal View History

import { defineConfig } from 'vite'
import { nodePolyfills } from 'vite-plugin-node-polyfills'
export default defineConfig({
server: {
headers: {
'Cross-Origin-Opener-Policy': 'same-origin',
'Cross-Origin-Embedder-Policy': 'require-corp',
},
},
plugins: [
nodePolyfills({
2024-01-17 00:28:40 +09:00
include: ['util'],
}),
{
name: 'configure-response-headers',
enforce: 'pre',
configureServer: (server) => {
server.middlewares.use((_req, res, next) => {
res.setHeader('Cross-Origin-Embedder-Policy', 'require-corp')
res.setHeader('Cross-Origin-Opener-Policy', 'same-origin')
next()
})
},
},
],
test: {
include: ['browser/**/*.{spec,test}.{js,jsx,ts,tsx}'],
browser: {
enabled: true,
name: 'chrome',
},
},
})