Skip to content

Commit c547f61

Browse files
committed
feat(plugin): Use ts-node instead of typescript module to support the register() method
1 parent b3bb3ee commit c547f61

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

index.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,8 @@ module.exports = {
66

77
'migrator:migration:hook:require': function() {
88

9-
/**
10-
* Always delay requires, otherwise your plugin will cause trouble
11-
* with db-migrates performance and generates issues to your users.
12-
*/
13-
require('typescript').register();
9+
// We use ts-node because the official typescript module does not implement the register() method
10+
require('ts-node').register();
1411

1512
/**
1613
* Return value of this hook can be both, pure value or a promise.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"description": "A db-migrate plugin to enable Typescript style migrations.",
55
"main": "index.js",
66
"dependencies": {
7-
"typescript": "^1.8.10"
7+
"ts-node": "^1.3.0"
88
},
99
"devDependencies": {},
1010
"scripts": {

0 commit comments

Comments
 (0)