When I specify either the module
or target
property in the compiler options to esnext (so I can use import("example")
statements), my es6 import statements for npm installed libraries stop working (local modules like "./test.ts"
still work).
For example,
import * as asd from "testmodule";
throws an error saying cannot find module 'testmodule'
. However, removing both properties makes it work. Why is this happening and which ES standard should I follow in order to use both import("example")
and import * as asd from "testmodule";
statements?
Below is my complete tsconfig.json:
{
"compilerOptions": {
"outDir": "./dist/",
"module": "esnext",
"target": "esnext",
"allowJs": true,
"sourceMap": true
}
}