@storm-stack/core
Version:
A build toolkit and runtime used by Storm Software in TypeScript applications
60 lines (57 loc) • 1.88 kB
JavaScript
import { resolveESBuildOptions } from './chunk-YUI6K7XK.js';
import { __name } from './chunk-IRPJW6HH.js';
import { joinPaths } from '@stryke/path/join-paths';
import defu from 'defu';
function resolveViteOptions(context, override = {}) {
return defu({
resolve: {
alias: context.vfs.runtimeIdMap.keys().reduce((ret, id) => {
const path = context.vfs.runtimeIdMap.get(id);
if (path) {
ret[id] = path;
}
return ret;
}, {})
}
}, override, context.options.variant === "vite" ? context.options.override : {}, {
external: context.options.external,
noExternal: context.options.noExternal,
skipNodeModulesBundle: context.options.skipNodeModulesBundle
}, {
rootDir: context.options.sourceRoot,
mode: context.options.mode === "development" ? "development" : "production",
cacheDir: joinPaths(context.cachePath, "vite"),
build: {
minify: context.options.mode !== "development",
metafile: context.options.mode === "development",
sourcemap: context.options.mode === "development",
outDir: context.options.output.outputPath,
tsconfig: context.tsconfig.tsconfigFilePath,
tsconfigRaw: context.tsconfig.tsconfigJson
},
esbuild: resolveESBuildOptions(context),
assetsInclude: context.options.output.assets,
logLevel: context.options.logLevel,
envDir: context.options.projectRoot,
noExternal: Array.from(context.vfs.runtimeIdMap.keys())
}, context.options.variant === "vite" ? context.options.build : {}, {
resolve: {
extensions: [
".mjs",
".js",
".mts",
".ts",
".jsx",
".tsx",
".json"
]
},
json: {
stringify: true
},
logLevel: "silent",
clearScreen: true
});
}
__name(resolveViteOptions, "resolveViteOptions");
export { resolveViteOptions };