Skip to content

Commit 0fd5ea0

Browse files
authored
Prevent ts-node being registered twice
1 parent ac82119 commit 0fd5ea0

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

index.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,13 @@ class ServerlessWebpack {
2626
this.options = options;
2727

2828
if (
29-
(_.has(this.serverless, 'service.custom.webpack') &&
30-
_.isString(this.serverless.service.custom.webpack) &&
31-
_.endsWith(this.serverless.service.custom.webpack, '.ts')) ||
32-
(_.has(this.serverless, 'service.custom.webpack.webpackConfig') &&
33-
_.endsWith(this.serverless.service.custom.webpack.webpackConfig, '.ts'))
29+
(
30+
(_.has(this.serverless, 'service.custom.webpack') &&
31+
_.isString(this.serverless.service.custom.webpack) &&
32+
_.endsWith(this.serverless.service.custom.webpack, '.ts')) ||
33+
(_.has(this.serverless, 'service.custom.webpack.webpackConfig') &&
34+
_.endsWith(this.serverless.service.custom.webpack.webpackConfig, '.ts'))
35+
) && !process[Symbol.for('ts-node.register.instance')]
3436
) {
3537
try {
3638
require('ts-node/register');

0 commit comments

Comments
 (0)