Skip to content
This repository has been archived by the owner on Dec 1, 2019. It is now read-only.

importHelpers option is broken and fails with "Cannot find module 'tslib'" #250

Open
lhecker opened this issue Oct 7, 2016 · 7 comments

Comments

@lhecker
Copy link

lhecker commented Oct 7, 2016

The new importHelpers feature in TypeScript does not seem to work with awesome-typescript-loader.

Setting this option in the tsconfig.json file:

{
    "compilerOptions": {
        "importHelpers": true
    }
}

causes the following error:

ERROR in [default]
Cannot find module 'tslib'.

even though the tslib module was successfully included by WebPack:

  [234] ./~/tslib/tslib.js 4.26 kB {0} [built]

Anything I can do to help you fix this issue? 🙂

@Jessidhia
Copy link
Contributor

This error seems is actually emitted by tsc itself.

When I checked, tsc was actually using classic module resolution due to having "module": "es2015" in the settings, which, of course, prevented it from finding the tslib inside node_modules. Adding "moduleResolution": "node" fixed it.

@Delagen
Copy link

Delagen commented Nov 10, 2016

@Kovensky can it be resolved using paths section of tsconfig.json?

@timocov
Copy link

timocov commented Nov 23, 2016

@Kovensky With "target": "es5" it happens too (for es5 node module resolution is used by default).

Also, if you run ./node_modules/.bin/tsc --noEmit then no error happens (in my case of course)
ts-loader does not output that error.

@timocov
Copy link

timocov commented Nov 23, 2016

Also, result bundle have tslib module (and all requires is fine) but error happened

@timocov
Copy link

timocov commented Nov 23, 2016

Seems that in 3.0.0-beta.5 it is fixed.

@ghost
Copy link

ghost commented Dec 7, 2016

I had to set moduleResolution to node in my tsconfig.json to get the error to go away.

@Delagen
Copy link

Delagen commented Feb 13, 2017

if tslib is not direct dependency and resolved via webpack this message emits

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants