Created by: gaearon
In 0.8.x, we switched to treat all non-JS/CSS extensions as files by default (#1059, #1077).
However when we tried to do the same in Jest, we made a mistake which introduced false positives (#1145 (closed), #1147 (closed)).
We temporarily reverted this change in #1149 and reopened https://github.com/facebookincubator/create-react-app/issues/667#issuecomment-264693934. @cpojer suggested to use transform
instead of moduleNameMapper
so that we can match against the full paths.
This PR implements that. I verified that the following cases work:
- Importing CSS both inside project directory and in
node_modules
(gives you `{}) - Importing arbitrary files both inside project directory and in
node_modules
(gives you the filename) - Importing JS modules like
../something
orlodash.assign
(covers #1145 (closed), #1147 (closed)).
Fixes #667 (closed).