Skip to content

Commit ef569b4

Browse files
committed
feature: @putout/plugin-nodejs: convert-commonjs-to-esm-require: do not add extension
1 parent efd389e commit ef569b4

File tree

4 files changed

+4
-7
lines changed

4 files changed

+4
-7
lines changed
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
import {'1' as tsx} from './ts.js';
1+
import {'1' as tsx} from './ts';
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
const dir = '../';
2-
import a from '../config.js';
2+
import a from '../config';
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
import server from './server.js';
1+
import server from './server';

packages/plugin-nodejs/lib/convert-commonjs-to-esm-require/index.js

+1-4
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,7 @@ export const replace = () => ({
7171
}`,
7272
'require("__a")': 'import("__a")',
7373
'const __a = require(__b)': ({__a}, path) => {
74-
let {value} = path.get(__B).evaluate();
75-
76-
if (value.includes('./') && !/\.m?js(on)?$/.test(value) && !value.endsWith('..'))
77-
value += '.js';
74+
const {value} = path.get(__B).evaluate();
7875

7976
const fnPath = path.findParent(isFunction);
8077

0 commit comments

Comments
 (0)