Skip to content

Commit

Permalink
preload function is now under the render property (#10)
Browse files Browse the repository at this point in the history
* Check for location of preload function before eval
* Test with Next.js v9, upgrade Jest to fix import issue
  • Loading branch information
ricardo-cantu authored and exogen committed Nov 6, 2019
1 parent 8125688 commit 6324760
Show file tree
Hide file tree
Showing 4 changed files with 3,045 additions and 1,542 deletions.
5 changes: 4 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ function createFactory(moduleName) {
options = mockOptions;
}
const LoadableComponent = dynamic(loader, options);
mockInitializers.push(() => LoadableComponent.preload());
mockInitializers.push(() =>
LoadableComponent.preload
? LoadableComponent.preload()
: LoadableComponent.render.preload());
return LoadableComponent;
};

Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
"babel-core": "^7.0.0-bridge",
"babel-jest": "^24.1.0",
"babel-plugin-dynamic-import-node": "^2.2.0",
"jest": "^24.1.0",
"next": "^8.0.2",
"jest": "^24.9.0",
"next": "^9.0.0",
"react": "^16.8.3",
"react-dom": "^16.8.3",
"react-test-renderer": "^16.8.3"
Expand Down
Empty file removed test/util.js
Empty file.
Loading

0 comments on commit 6324760

Please sign in to comment.