Skip to content

Commit e457ec0

Browse files
Ayase-252targos
authored andcommitted
lib: fix checking syntax of esm module
Fixes: #41189 PR-URL: #41198 Refs: #37468 Reviewed-By: Derek Lewis <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Tobias Nießen <[email protected]>
1 parent d83a029 commit e457ec0

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

lib/internal/main/check_syntax.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ function checkSyntax(source, filename) {
5454
const { defaultResolve } = require('internal/modules/esm/resolve');
5555
const { defaultGetFormat } = require('internal/modules/esm/get_format');
5656
const { url } = defaultResolve(pathToFileURL(filename).toString());
57-
const { format } = defaultGetFormat(url);
57+
const format = defaultGetFormat(url);
5858
isModule = format === 'module';
5959
}
6060
if (isModule) {

test/fixtures/syntax/good_syntax.mjs

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export function testFunction(req, res) {
2+
return 'PASS';
3+
}

test/sequential/test-cli-syntax-good.js

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ const syntaxArgs = [
1717
[
1818
'syntax/good_syntax.js',
1919
'syntax/good_syntax',
20+
'syntax/good_syntax.mjs',
2021
'syntax/good_syntax_shebang.js',
2122
'syntax/good_syntax_shebang',
2223
'syntax/illegal_if_not_wrapped.js',

0 commit comments

Comments
 (0)