Skip to content

Commit 2d907c8

Browse files
committed
fix(config/paths.js): Support "homepage" and "proxy" in elm.json for legacy reasons.
1 parent acfd7bf commit 2d907c8

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

config/paths.js

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,26 @@ const cosmiconfig = require('cosmiconfig');
1010
const appDirectory = fs.realpathSync(process.cwd());
1111
const resolveApp = relativePath => path.resolve(appDirectory, relativePath);
1212

13-
// We use 'cosmiconfig' to look for the configuration file.
13+
// We look for configration in files supported by cosmiconfig by default:
14+
// https://github.com/davidtheclark/cosmiconfig
1415
const explorer = cosmiconfig('elmapp');
1516
const result = explorer.searchSync(appDirectory);
16-
const config = result ? result.config : {};
17+
const config = result ? result.config : loadElmJson();
18+
19+
// WARNING:
20+
// We support config in elm.json only for legacy reasons.
21+
// elm-package removes the settings, so this will be removed in the future.
22+
function loadElmJson() {
23+
try {
24+
const elmJson = require(resolveApp('elm.json'));
25+
if (elmJson.homepage || elmJson.proxy) {
26+
return elmJson;
27+
}
28+
} catch (error) {
29+
return {};
30+
}
31+
return {};
32+
}
1733

1834
const envPublicUrl = process.env.PUBLIC_URL;
1935

0 commit comments

Comments
 (0)