prev-cli 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +18 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -289,8 +289,25 @@ function findCliRoot2() {
|
|
|
289
289
|
}
|
|
290
290
|
return path4.dirname(path4.dirname(fileURLToPath2(import.meta.url)));
|
|
291
291
|
}
|
|
292
|
+
function findNodeModules(cliRoot2) {
|
|
293
|
+
const localNodeModules = path4.join(cliRoot2, "node_modules");
|
|
294
|
+
if (existsSync2(path4.join(localNodeModules, "react"))) {
|
|
295
|
+
return localNodeModules;
|
|
296
|
+
}
|
|
297
|
+
let dir = cliRoot2;
|
|
298
|
+
for (let i = 0;i < 10; i++) {
|
|
299
|
+
const parent = path4.dirname(dir);
|
|
300
|
+
if (parent === dir)
|
|
301
|
+
break;
|
|
302
|
+
if (path4.basename(parent) === "node_modules" && existsSync2(path4.join(parent, "react"))) {
|
|
303
|
+
return parent;
|
|
304
|
+
}
|
|
305
|
+
dir = parent;
|
|
306
|
+
}
|
|
307
|
+
return localNodeModules;
|
|
308
|
+
}
|
|
292
309
|
var cliRoot2 = findCliRoot2();
|
|
293
|
-
var cliNodeModules =
|
|
310
|
+
var cliNodeModules = findNodeModules(cliRoot2);
|
|
294
311
|
var srcRoot2 = path4.join(cliRoot2, "src");
|
|
295
312
|
async function createViteConfig(options) {
|
|
296
313
|
const { rootDir, mode, port } = options;
|