Typescript: Can not find module of 3rd-party library when `module` is `esnext` in `tsconfig.json` for typescript 2.4.0

Created on 13 Jun 2017  ·  2Comments  ·  Source: microsoft/TypeScript

TypeScript Version: 2.4.0

Code

import * as Vue from "vue";
console.log(Vue);
{
    "compilerOptions": {
        "target": "es5",
        "module": "esnext"
    }
}

Expected behavior:

no error.

Actual behavior:

error TS2307: Cannot find module 'vue'.

Reference 1 of js file with same source code:

Result: works fine with webpack.

Reference 2 of with same source code and this tsconfig.json:

{
    "compilerOptions": {
        "target": "es5",
        "module": "commonjs"
    }
}

Result: no compilation error, and works fine with webpack.

Most helpful comment

Try setting moduleResolution to node.

All 2 comments

Try setting moduleResolution to node.

Was this page helpful?
0 / 5 - 0 ratings