File tree Expand file tree Collapse file tree 2 files changed +2
-6
lines changed
packages/plugin-nodejs/lib/convert-commonjs-to-esm/require Expand file tree Collapse file tree 2 files changed +2
-6
lines changed Original file line number Diff line number Diff line change 1- const Pack = require ( '../package' ) ;
1+ import Pack from '../package' ;
Original file line number Diff line number Diff line change @@ -36,7 +36,6 @@ const createImport = ({name, source}) => {
3636} ;
3737
3838const createFnDeclaration = template ( 'const NAME1 = FN(NAME2)' ) ;
39- const isPackage = ( { value} ) => / p a c k a g e ( \. j s o n ) ? $ / . test ( value ) ;
4039
4140export const match = ( ) => ( {
4241 'export const __a = require("__b")' : ( { __a} , path ) => {
@@ -51,7 +50,7 @@ export const match = () => ({
5150
5251 return isProgram ( path . parentPath . parentPath ) ;
5352 } ,
54- 'const __a = require(__b)' : ( { __b } , path ) => {
53+ 'const __a = require(__b)' : ( vars , path ) => {
5554 if ( isExportNamedDeclaration ( path . parentPath ) )
5655 return false ;
5756
@@ -62,9 +61,6 @@ export const match = () => ({
6261
6362 const { confident, value} = __bPath . evaluate ( ) ;
6463
65- if ( isPackage ( __b ) )
66- return false ;
67-
6864 return value && confident ;
6965 } ,
7066 'require("__a")' : ( vars , path ) => Boolean ( path . parentPath . parentPath . isProgram ( ) ) ,
You can’t perform that action at this time.
0 commit comments