diff --git a/src/node/index.ts b/src/node/index.ts index c658687..d6ead21 100644 --- a/src/node/index.ts +++ b/src/node/index.ts @@ -68,6 +68,7 @@ function getViteConfig( css: { postcss: resolvedPostCssConfig, }, + envDir: options.cwd, envPrefix: ['VITE_', 'KIRBYUP_'], customLogger: logger, logLevel, diff --git a/test/__snapshots__/index.test.ts.snap b/test/__snapshots__/index.test.ts.snap index 0adc4c2..b1edfcd 100644 --- a/test/__snapshots__/index.test.ts.snap +++ b/test/__snapshots__/index.test.ts.snap @@ -36,7 +36,7 @@ exports[`supports built-in env variables 1`] = ` `; exports[`supports custom env variables 1`] = ` -"var kirbyupExport=function(e){"use strict";var t={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1};const o=t.KIRBYUP_FOO;return e.foo=o,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),e}({}); +"var kirbyupExport=function(o){"use strict";const r="bar";return o.foo=r,Object.defineProperty(o,Symbol.toStringTag,{value:"Module"}),o}({}); " `; diff --git a/test/index.test.ts b/test/index.test.ts index 0341a60..35f1404 100644 --- a/test/index.test.ts +++ b/test/index.test.ts @@ -1,5 +1,5 @@ +import * as fsp from 'node:fs/promises' import { fileURLToPath } from 'node:url' -import { remove } from 'fs-extra' import { resolve } from 'pathe' import { afterAll, beforeAll, expect, it, vi } from 'vitest' import { cacheDir, runCli } from './utils' @@ -9,12 +9,12 @@ const currentDir = fileURLToPath(new URL('.', import.meta.url)) beforeAll(async () => { // Unset so kirbyup applies its default environment setting vi.stubEnv('NODE_ENV', '') - await remove(cacheDir) + await fsp.rm(cacheDir, { recursive: true, force: true }) }) afterAll(async () => { vi.unstubAllEnvs() - await remove(cacheDir) + await fsp.rm(cacheDir, { recursive: true, force: true }) }) it('builds index.js', async () => {