feat: add support for vite define

This commit is contained in:
Derrick Hammer 2023-07-29 13:54:39 -04:00
parent 90597a495c
commit ae2b679700
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
2 changed files with 3 additions and 0 deletions

View File

@ -32,12 +32,14 @@ function buildOptions(context: PresetContext) {
throw new Error("vite options missing!");
}
const define = opts.define;
const build = opts.build;
const resolve = opts.resolve;
const optimize = opts.optimize;
const polyfill = opts.polyfill;
return {
viteDefine: resolveDirective(define, context).stringifiedConfig,
viteBuild: resolveDirective(build, context).stringifiedConfig,
viteResolve: resolveDirective(resolve, context).stringifiedConfig,
viteOptimize: resolveDirective(optimize, context).stringifiedConfig,

View File

@ -2,6 +2,7 @@ import { defineConfig } from "vite";
import optimizer from "vite-plugin-optimizer";
import { nodePolyfills } from "vite-plugin-node-polyfills";
export default defineConfig({
define: {viteDefine},
build: {viteBuild},
resolve: {viteResolve},
plugins: [