Skip to content

Commit 5757437

Browse files
committed
fix passing compilerOptions
1 parent 327e731 commit 5757437

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

lib/compiler.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,16 @@ var compiler = {
7777
tmpDir = options['cache-directory']
7878
? path.resolve(options['cache-directory'])
7979
: path.join(os.tmpdir(), '.ts-node')
80-
80+
var compilerOptions
81+
if (options['compilerOptions']) {
82+
try {
83+
compilerOptions = JSON.parse(options['compilerOptions'])
84+
} catch (e) {
85+
console.log('Could not parse compilerOptions', options['compilerOptions'])
86+
console.log(e)
87+
}
88+
}
89+
8190
var tsNodeOptions = {
8291
fast: options['fast'],
8392
cache: options['cache'] || !options['no-cache'],
@@ -91,7 +100,7 @@ var compiler = {
91100
ignoreWarnings: options['ignoreWarnings'] || options['ignoreDiagnostics'],
92101
ignoreDiagnostics: options['ignoreDiagnostics'],
93102
disableWarnings: options['disableWarnings'],
94-
compilerOptions: options['compilerOptions']
103+
compilerOptions: compilerOptions
95104
}
96105
try {
97106
register(tsNodeOptions)

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ts-node-dev",
3-
"version": "1.0.0-pre.17",
3+
"version": "1.0.0-pre.18",
44
"description": "Compiles your TS app and restarts when files are modified.",
55
"keywords": [
66
"restart",
@@ -33,7 +33,7 @@
3333
},
3434
"scripts": {
3535
"test-node-dev": "tap test/*.js",
36-
"test": "node ./bin/ts-node-dev -r ./test/ts/add-require.js --respawn --ignore-watch 'lib' --ignore-watch bin --prefer-ts --cache-directory .ts-node test/ts/test-script test-arg --fd",
36+
"test": "node ./bin/ts-node-dev -r ./test/ts/add-require.js -O \"{\\\"module\\\": \\\"commonjs\\\"}\" --respawn --ignore-watch 'lib' --ignore-watch bin --prefer-ts --cache-directory .ts-node test/ts/test-script test-arg --fd",
3737
"test-docker": "docker run --rm -v ${PWD}:/app mhart/alpine-node:8.7.0 sh -c 'cd app && node ./bin/ts-node-dev --cache-directory .ts-node test/ts/big'"
3838
},
3939
"dependencies": {

0 commit comments

Comments
 (0)