Skip to content

Commit 0efb1e0

Browse files
committed
Fix getConfig require needing .default
1 parent ec6b571 commit 0efb1e0

4 files changed

Lines changed: 18 additions & 4 deletions

File tree

config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
var getConfig = require("next/config");
1+
var getConfig = require("next/config").default;
22

33
var { serverRuntimeConfig, publicRuntimeConfig } = getConfig();
44

config.test.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
jest.mock(
22
"next/config",
3-
() =>
4-
function getConfig() {
3+
() => ({
4+
default: function getConfig() {
55
return {
66
serverRuntimeConfig: { secret: 12345 },
77
publicRuntimeConfig: { api: "/graphql" }
88
};
9-
},
9+
}
10+
}),
1011
{ virtual: true }
1112
);
1213

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"next": ">=5.1.0"
1919
},
2020
"devDependencies": {
21+
"config": "^2.0.1",
2122
"jest": "^23.5.0",
2223
"prettier": "^1.14.2"
2324
}

yarn.lock

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -627,6 +627,12 @@ concat-map@0.0.1:
627627
version "0.0.1"
628628
resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b"
629629

630+
config@^2.0.1:
631+
version "2.0.1"
632+
resolved "https://registry.yarnpkg.com/config/-/config-2.0.1.tgz#995ccc8175460578d646ac0a2e4018ffa44ca046"
633+
dependencies:
634+
json5 "^1.0.1"
635+
630636
console-control-strings@^1.0.0, console-control-strings@~1.1.0:
631637
version "1.1.0"
632638
resolved "https://registry.yarnpkg.com/console-control-strings/-/console-control-strings-1.1.0.tgz#3d7cf4464db6446ea644bf4b39507f9851008e8e"
@@ -1898,6 +1904,12 @@ json5@^0.5.1:
18981904
version "0.5.1"
18991905
resolved "https://registry.yarnpkg.com/json5/-/json5-0.5.1.tgz#1eade7acc012034ad84e2396767ead9fa5495821"
19001906

1907+
json5@^1.0.1:
1908+
version "1.0.1"
1909+
resolved "https://registry.yarnpkg.com/json5/-/json5-1.0.1.tgz#779fb0018604fa854eacbf6252180d83543e3dbe"
1910+
dependencies:
1911+
minimist "^1.2.0"
1912+
19011913
jsprim@^1.2.2:
19021914
version "1.4.1"
19031915
resolved "https://registry.yarnpkg.com/jsprim/-/jsprim-1.4.1.tgz#313e66bc1e5cc06e438bc1b7499c2e5c56acb6a2"

0 commit comments

Comments
 (0)