-
-
Notifications
You must be signed in to change notification settings - Fork 433
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
TypeScript compiler option "moduleResolution" is not inferred as it is by tsc
#132
Comments
The versions I'm using, FWIW:
|
The goal is definitely for ts-loader to work the same as |
Not the simplest example, but here's what I was working on when I encountered this. And the steps to recreate (I just tested this like 5 minutes ago so if you don't hit the same issue then something weird is going on with my machine):
webpack output with error:
The import line in question in
|
Perfect, thanks! |
I believe this is related to #111. Basically TypeScript's logic is if |
This has been fixed and published in v0.8.0. |
tsc
will infer thatmoduleResolution: "node"
if I havemodule: "commonjs"
in mytsconfig.json
, even if I also havetarget: "ES6"
(it won't default to node-style moduleResolution ifmodule
is set to "es6" and target is also set to "ES6").However, when compiling with
ts-loader
via webpack, I have to explicitly addmoduleResolution: "node"
to my tsconfig file to avoid "Cannot find module 'whatever'" errors in the output.Adding that line,
"moduleResolution": "node"
is trivial. Figuring out that I need to add it, to resolve errors that webpack + ts-loader was throwing at me, was frustrating. I would expect ts-loader's (default) behavior to match tsc's (default) behavior, particularly when the ts-loader log message says it's using exactly the same tsconfig file that tsc is using.The text was updated successfully, but these errors were encountered: