File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed
Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -5,13 +5,15 @@ import { TypeScriptCompileError } from "./typescript-compile-error";
55export function TypeScriptLoader ( options ?: RegisterOptions ) : Loader {
66 return ( path : string , content : string ) => {
77 try {
8- register ( options ) . compile ( content , path ) ;
8+ // cosmiconfig requires the transpiled configuration to be CJS
9+ register ( { ...options , compilerOptions : { module : "commonjs" } } ) . compile (
10+ content ,
11+ path
12+ ) ;
913 const result = require ( path ) ;
1014
11- /**
12- * `default` is used when exporting using export default, some modules
13- * may still use `module.exports` or if in TS `export = `
14- */
15+ // `default` is used when exporting using export default, some modules
16+ // may still use `module.exports` or if in TS `export = `
1517 return result . default || result ;
1618 } catch ( error ) {
1719 if ( error instanceof Error ) {
You can’t perform that action at this time.
0 commit comments