Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the .mjs extension to the default extensions #172

Merged
merged 3 commits into from
May 15, 2017
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 @@