Skip to content

Commit

Permalink
fix(utils): ts-node check now runs in a webpack environment (#657)
Browse files Browse the repository at this point in the history
Previously this check would break if Mikro v4 was bundled via webpack.
  • Loading branch information
Kevin Brown authored and B4nan committed Aug 9, 2020
1 parent f0d6ef0 commit 4384019
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/core/src/utils/Utils.ts
Expand Up @@ -436,7 +436,7 @@ export class Utils {
static detectTsNode(): boolean {
return process.argv[0].endsWith('ts-node') // running via ts-node directly
|| process.argv.slice(1).some(arg => arg.includes('ts-node')) // registering ts-node runner
|| !!require.extensions['.ts'] // check if the extension is registered
|| (require.extensions && !!require.extensions['.ts']) // check if the extension is registered
|| !!new Error().stack!.split('\n').find(line => line.match(/\w\.ts:\d/)); // as a last resort, try to find a TS file in the stack trace
}

Expand Down

0 comments on commit 4384019

Please sign in to comment.