Ts-jest: Importing from node_modules that contain Typescript causes SyntaxErrors

Created on 10 May 2017  路  2Comments  路  Source: kulshekhar/ts-jest

  • Issue

We have some internal modules that contain Typescript and transpiled Javascript. When importing code from a module like this from node_modules (i.e. installing a private npm package), the imported code doesn't transpile properly and causes the following Syntax Error:
SyntaxError: Unexpected token export

However, when the same code is loaded from a directory outside of node_modules, it works fine.

  • Expected behavior

These modules can be imported into tests and there is no Syntax Error

  • Link to a minimal repo that reproduces this issue
    https://github.com/bmajz/tsjestissue

  • Optional (but highly recommended) - Configure Travis (or your favorite system) with the minimal repo

This allows potential solutions to be tested against the minimal repo. This saves everyone time and avoids a lot of back and forth.

Most helpful comment

@bmajz the PR I've sent to the repo you've linked should fix this. If not, let me know and I'll reopen this

All 2 comments

@bmajz the PR I've sent to the repo you've linked should fix this. If not, let me know and I'll reopen this

Thanks @kulshekhar!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jbreckmckye picture jbreckmckye  路  3Comments

Slessi picture Slessi  路  3Comments

TKJohn picture TKJohn  路  4Comments

GeeWee picture GeeWee  路  4Comments

ahnpnl picture ahnpnl  路  3Comments