Skip to content

Commit

Permalink
Add a fallback for ESM in react-test-renderer/shallow
Browse files Browse the repository at this point in the history
  • Loading branch information
NMinhNguyen committed Feb 29, 2020
1 parent 8ccfce4 commit 492020c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/react-test-renderer/npm/shallow.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
'use strict';

module.exports = require('react-shallow-renderer');
var ReactShallowRenderer = require('react-shallow-renderer');

// This is hacky but makes it work with webpack preferring to load ESM
// even if imported via `require()`, and `react-shallow-renderer` ships with ESM.
// See https://github.com/webpack/webpack/issues/7973
module.exports = ReactShallowRenderer.default || ReactShallowRenderer;

0 comments on commit 492020c

Please sign in to comment.