feat: add support for vite define
This commit is contained in:
parent
90597a495c
commit
ae2b679700
|
@ -32,12 +32,14 @@ function buildOptions(context: PresetContext) {
|
||||||
throw new Error("vite options missing!");
|
throw new Error("vite options missing!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const define = opts.define;
|
||||||
const build = opts.build;
|
const build = opts.build;
|
||||||
const resolve = opts.resolve;
|
const resolve = opts.resolve;
|
||||||
const optimize = opts.optimize;
|
const optimize = opts.optimize;
|
||||||
const polyfill = opts.polyfill;
|
const polyfill = opts.polyfill;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
viteDefine: resolveDirective(define, context).stringifiedConfig,
|
||||||
viteBuild: resolveDirective(build, context).stringifiedConfig,
|
viteBuild: resolveDirective(build, context).stringifiedConfig,
|
||||||
viteResolve: resolveDirective(resolve, context).stringifiedConfig,
|
viteResolve: resolveDirective(resolve, context).stringifiedConfig,
|
||||||
viteOptimize: resolveDirective(optimize, context).stringifiedConfig,
|
viteOptimize: resolveDirective(optimize, context).stringifiedConfig,
|
||||||
|
|
|
@ -2,6 +2,7 @@ import { defineConfig } from "vite";
|
||||||
import optimizer from "vite-plugin-optimizer";
|
import optimizer from "vite-plugin-optimizer";
|
||||||
import { nodePolyfills } from "vite-plugin-node-polyfills";
|
import { nodePolyfills } from "vite-plugin-node-polyfills";
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
|
define: {viteDefine},
|
||||||
build: {viteBuild},
|
build: {viteBuild},
|
||||||
resolve: {viteResolve},
|
resolve: {viteResolve},
|
||||||
plugins: [
|
plugins: [
|
||||||
|
|
Loading…
Reference in New Issue