Skip to content

Commit

Permalink
Fix preloading of modules (#258)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jontem authored and blakeembrey committed Dec 29, 2016
1 parent b2e6990 commit 50df9b1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
4 changes: 1 addition & 3 deletions src/_bin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,7 @@ const service = register({
})

// Require specified modules before start-up.
for (const id of arrify(argv.require)) {
Module._load(id)
}
;(Module as any)._preloadModules(arrify(argv.require))

/**
* Eval helpers.
Expand Down
9 changes: 9 additions & 0 deletions src/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,15 @@ describe('ts-node', function () {
return done()
})
})

it('should support require from node modules', function (done) {
exec(`${BIN_EXEC} -r typescript -e "console.log('success')"`, function (err, stdout) {
expect(err).to.not.exist
expect(stdout).to.equal('success\n')

return done()
})
})
})

describe('register', function () {
Expand Down

0 comments on commit 50df9b1

Please sign in to comment.