@forge/cli

13.1.013.2.0-next.4-experimental-c6a3916
out/module-add/vite-scaffolder.js
~out/module-add/vite-scaffolder.jsModified
+21
Index: package/out/module-add/vite-scaffolder.js
===================================================================
--- package/out/module-add/vite-scaffolder.js
+++ package/out/module-add/vite-scaffolder.js
@@ -1,14 +1,27 @@
 "use strict";
 Object.defineProperty(exports, "__esModule", { value: true });
 exports.planViteConfig = planViteConfig;
+exports.planGenericViteConfig = planGenericViteConfig;
 exports.planCommonJsx = planCommonJsx;
 exports.applyScaffoldChange = applyScaffoldChange;
 const tslib_1 = require("tslib");
 const fs_1 = tslib_1.__importDefault(require("fs"));
 const path_1 = tslib_1.__importDefault(require("path"));
 const diff_1 = require("diff");
 const cli_shared_1 = require("@forge/cli-shared");
+function renderGenericViteConfig() {
+    return `import { defineConfig } from 'vite';
+import react from '@vitejs/plugin-react';
+export default defineConfig({
+  plugins: [react()],
+  base: './',
+  build: {
+    outDir: 'build',
+  },
+});
+`;
+}
 function renderViteConfig(entry) {
     const sortedNames = Object.keys(entry).sort();
     const inputLines = sortedNames.map((name) => `        ${JSON.stringify(name)}: resolve(__dirname, ${JSON.stringify(entry[name])}),`);
     return `import { defineConfig } from "vite";
@@ -72,8 +85,16 @@
         return undefined;
     const patch = (0, diff_1.createTwoFilesPatch)(configPath, configPath, before, after, 'before', 'after');
     return { filePath: configPath, before, after, patch };
 }
+function planGenericViteConfig(cwd, resourceKey) {
+    const configPath = path_1.default.join(cwd, 'static', resourceKey, 'vite.config.js');
+    if (fs_1.default.existsSync(configPath))
+        return undefined;
+    const after = renderGenericViteConfig();
+    const patch = (0, diff_1.createTwoFilesPatch)(configPath, configPath, '', after, 'before', 'after');
+    return { filePath: configPath, before: '', after, patch };
+}
 function planCommonJsx(cwd, resourceKey) {
     const filePath = path_1.default.join(cwd, 'static', resourceKey, 'src', 'common.jsx');
     const exists = fs_1.default.existsSync(filePath);
     if (exists)