File tree Expand file tree Collapse file tree 1 file changed +3
-5
lines changed Expand file tree Collapse file tree 1 file changed +3
-5
lines changed Original file line number Diff line number Diff line change @@ -65,18 +65,16 @@ const parsers = (exports.parsers = {
6565 * @returns {Object } Parsed config object
6666 */
6767exports . loadConfig = filepath => {
68- const packageJson = require ( path . resolve ( utils . cwd ( ) , 'package.json' ) ) ;
6968 let config = { } ;
7069 debug ( 'loadConfig: trying to parse config at %s' , filepath ) ;
7170
7271 const ext = path . extname ( filepath ) ;
7372 try {
7473 if ( ext === '.yml' || ext === '.yaml' ) {
7574 config = parsers . yaml ( filepath ) ;
76- } else if ( ( ext === '.js' && packageJson . type === "module" ) || ext === '.mjs' ) {
77- config = parsers . js ( filepath ) . default ;
78- } else if ( ext === '.js' || ext === '.cjs' ) {
79- config = parsers . js ( filepath ) ;
75+ } else if ( ext === '.js' || ext === '.cjs' || ext === '.mjs' ) {
76+ const parsedConfig = parsers . js ( filepath ) ;
77+ config = parsedConfig . default ?? parsedConfig ;
8078 } else {
8179 config = parsers . json ( filepath ) ;
8280 }
You can’t perform that action at this time.
0 commit comments