MCPcopy Index your code
hub / github.com/NativeScript/NativeScript / ensureViteConfig

Function ensureViteConfig

packages/vite/helpers/init.ts:121–131  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

119}
120
121function ensureViteConfig() {
122 const root = getProjectRootPath();
123 const viteConfigPath = path.join(root, 'vite.config.ts');
124 if (fs.existsSync(viteConfigPath)) {
125 return;
126 }
127 const flavor = resolveFlavor();
128 const { importLine, configExpr } = getFlavorImportAndConfig(flavor);
129 const contents = `import { defineConfig } from 'vite';\n${importLine};\n\nexport default defineConfig(({ mode }) => ${configExpr});\n`;
130 fs.writeFileSync(viteConfigPath, contents, 'utf8');
131}
132
133export async function runInit() {
134 const pkg = readPackageJson();

Callers 1

runInitFunction · 0.85

Calls 4

resolveFlavorFunction · 0.85
getFlavorImportAndConfigFunction · 0.85
joinMethod · 0.80
getProjectRootPathFunction · 0.70

Tested by

no test coverage detected