mirror of
https://github.com/hanzoai/vite.git
synced 2026-10-30 19:36:16 +00:00
47 lines
1.0 KiB
JavaScript
47 lines
1.0 KiB
JavaScript
import fs from 'node:fs'
|
|
import path from 'node:path'
|
|
import { defineConfig } from 'vite'
|
|
|
|
export default defineConfig({
|
|
esbuild: {
|
|
supported: {
|
|
// Force esbuild inject helpers to test regex
|
|
'object-rest-spread': false,
|
|
'optional-chain': false,
|
|
},
|
|
},
|
|
build: {
|
|
// Force oxc inject helpers to test regex
|
|
// - object rest spread
|
|
// - optional chaining
|
|
target: 'chrome46',
|
|
rolldownOptions: {
|
|
output: {
|
|
comments: { legal: true },
|
|
banner: `/*!\nMayLib\n*/`,
|
|
},
|
|
},
|
|
lib: {
|
|
entry: path.resolve(import.meta.dirname, 'src/main.js'),
|
|
name: 'MyLib',
|
|
formats: ['es', 'umd', 'iife'],
|
|
fileName: 'my-lib-custom-filename',
|
|
},
|
|
},
|
|
plugins: [
|
|
{
|
|
name: 'emit-index',
|
|
generateBundle() {
|
|
this.emitFile({
|
|
type: 'asset',
|
|
fileName: 'index.html',
|
|
source: fs.readFileSync(
|
|
path.resolve(import.meta.dirname, 'index.dist.html'),
|
|
'utf-8',
|
|
),
|
|
})
|
|
},
|
|
},
|
|
],
|
|
})
|