Skip to content

Commit 10e97a7

Browse files
committed
fix: check if light.config.js exists
1 parent 5cc9a07 commit 10e97a7

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

config.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
const path = require('path');
2+
const fs = require('fs');
23
const glob = require('glob');
34
const modRewrite = require('connect-modrewrite');
45
const pug = require('pug');
@@ -461,6 +462,8 @@ const defaultConfig = (paths, config) => ({
461462

462463
class Config {
463464
constructor() {
465+
const configPath = path.join(cwd(), 'light.config.js');
466+
464467
const defaultPaths = {
465468
app: path.posix.join(process.cwd(), 'app'),
466469
tmp: path.posix.join(process.cwd(), '.tmp'),
@@ -480,8 +483,11 @@ class Config {
480483

481484
let config = {};
482485
let paths = {};
486+
let myConfig = null;
483487

484-
const myConfig = require(path.posix.join(process.cwd(), 'light.config.js')); // eslint-disable-line
488+
if (fs.existsSync(configPath)) {
489+
myConfig = require(configPath); // eslint-disable-line
490+
}
485491

486492
if (typeof (myConfig) === 'function') {
487493
({ config = {}, paths = {} } =

0 commit comments

Comments
 (0)