-
Notifications
You must be signed in to change notification settings - Fork 449
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
regression of Unexpected token import when using es2015 modules #161
Comments
@piotrwitek see #146 There was a comment that if users don't care about coverage but want to set So here are the options:
Note that if the config file is anything but 'tsconfig.json' in the root directory, it will leave the |
@piotrwitek I should also add that the |
@kulshekhar Thanks for your answer, this change has broken my build when updated from 19.0.1 to 19.0.8, which violate semver :/ I still think that current solution is not optimal and good enough for my use case, I think a new option could be introduced:
This solution could be flexible enough and if implemented without changing old behaviour for e.g. if only Then on next major jump deprecate the old way and promote new configuration. Is this something you would like to consider @kulshekhar ? |
This project doesn't follow semver, sorry. The change you suggest would break almost every other setup that uses an external config file. Can you share the tsconfig that you're using for testing? In most cases, you don't even need one |
@kulshekhar could you explain why you think it will break other setup?
IMO this doesn'e break anything, but maybe I don't understand something |
in detail I would add a new if branch checking if (TS_CONFIG & TS_CONFIG_PATH) are provided and only then execute a new logic, make sense? |
Currently TS_CONFIG can be either an object or a filename. Moreover, I don't like the idea of introducing more global variables - it can complicate matters unnecessarily. Again, can you share the tsconfig that you're using for testing |
please also share the |
|
Have you tried removing the |
In the worst case - suppose you need all these settings for testing as well - you could create a separate file for testing, like so: {
"extends": "./tsconfig.json",
"compilerOptions": {
"module": "commonjs"
}
} and use this new file in |
@kulshekhar yes I know but this is a workaround not a solution for example |
@piotrwitek I agree this is confusing. But I accepted this as a PR a while back and didn't give it much thought then. I didn't think it this project would be used by more than a few folks! I have plans to refactor the whole project to remove cruft and make it easier to extend. Unfortunately I'm not sure when I'll be able to carve out some time. For now, I'm trying to help users of this package by fixing bugs and issues that are show stoppers. Would the workaround suggested above be an acceptable solution for you for the time being? |
@kulshekhar I understand, this is not an easy work, I really appreciate your work don't get me wrong, just wanted to suggest a way to improve it somehow, maybe it's not the best solution but might be some direction to follow :) Suggested workaround is the best solution possible right now and should be fine for now, and I'm still open to help in the future. |
@kulshekhar count on me if you need help for that refactor, you're not alone ;) I'd like to help if I can |
@alexjoverm Thanks! I'm waiting for the next jest version to land but in the meanwhile, we can start by creating a checklist of what needs to be done |
@kulshekhar some things that roughly come up to my mind:
I'm saying this by having taken a peak to the code, but I have no actual context :). Where can we create that checklist? What are your suggestions @kulshekhar ? |
regression of previously resolved issue Not processing correctly when using es2015 modules #121 Hardcode module commonjs #123
SyntaxError: Unexpected token import when using es2015 modules with following config:
If following line is taken out of enclosing if statement, problem is fixed.
d26dbf6#diff-e1495d267619047a7cca5cfe8f692729R88
should set
config.module = 'commonjs';
when loading externaltsconfig
with"module": "es2015"
The text was updated successfully, but these errors were encountered: