Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/normalizeOptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import findBabelConfig from 'find-babel-config';
import glob from 'glob';
import pkgUp from 'pkg-up';

const defaultExtensions = ['.js', '.jsx', '.es', '.es6'];
const defaultExtensions = ['.js', '.jsx', '.es', '.es6', '.mjs'];

function isRegExp(string) {
return string.startsWith('^') || string.endsWith('$');
Expand Down
8 changes: 8 additions & 0 deletions test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,14 @@ describe('module-resolver', () => {
);
});

it('should resolve the file path with the node module extension', () => {
testWithImport(
'nodemodule',
'./test/testproject/src/nodemodule',
rootTransformerOpts,
);
});

it('should not resolve the file path with an unknown extension', () => {
testWithImport(
'text',
Expand Down
1 change: 1 addition & 0 deletions test/testproject/src/nodemodule.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@