Commit c6375edc authored by Lee Byron's avatar Lee Byron Committed by Joe Haddad
Browse files

`.mjs` should not resolve before .js files (#4085)

Support for .mjs files added in #3239 did not account for npm libraries which ship native mjs files alongside js files. This accounts for this by ensuring .js files resolve before their accompanying .mjs file. Note that this is not an ideal end state since selecting a .mjs over a .js extension should be the result of whether `import` was used instead of `require()` in a node environment with native ESM support (currently via `--experimental-modules`). Instead, this change just *always* selects a .js extension before the .mjs extension if it exists.

This unbreaks support for using GraphQL (relay, apollo, etc) within create-react-app projects.
parent 0b1d6365
16 merge requests!4749replace workspaceRoot with workspaceFolder,!4933Facebook next,!12191Lim.Pisey.168:/Identified - We are currently investigating reports of missing build logs. The issue has been identified and a resolution is in progress. We will provide a further update when available.Mar 21, 09:02 UTC,!12853brikk,!4397Master,!5023Master,!4330Fix broken link,!4886Proper folder structure,!4219Patch 1,!5717Automatically extract project file structure from build bundle file,!4217Tiny typo in comment,!4950Master,!5063Babel 7,!4394Patch 1,!4223Master,!4324Fixed typo
Showing with 1 addition and 1 deletion
+1 -1
...@@ -45,12 +45,12 @@ module.exports = (resolve, rootDir, isEjecting) => { ...@@ -45,12 +45,12 @@ module.exports = (resolve, rootDir, isEjecting) => {
}, },
moduleFileExtensions: [ moduleFileExtensions: [
'web.js', 'web.js',
'mjs',
'js', 'js',
'json', 'json',
'web.jsx', 'web.jsx',
'jsx', 'jsx',
'node', 'node',
'mjs',
], ],
}; };
if (rootDir) { if (rootDir) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment