Created by: mostafah
Jest’s default value for its moduleFileExtensions
option is ["js", "json", "jsx", "node"]
. CRA was not using this option before version 1.0.8, so this default list was used.
PR #2511 (merged in version 1.0.8) sets this option to ["web.js", "js", "json", "web.jsx", "jsx"]
. The PR is about adding .web
extensions, but it is also removing .node
because it is not included like other default extensions.
Why is this a bug?
Packages using native code through node-gyp
import files with .node
extension. Using those packages fails the tests with a Cannot find module …
error.
This used to work with version 1.0.7.
Reproduction and testing
This repo is a minimal reproduction of this bug. Tests fail there. Changing react-scripts
to 1.0.7 or manually applying this change to node_modules/react-scripts/scripts/utils/createJestConfig.js
fixes the problem.