Webpack "Cannot find module" for "module": "esnext"

Viewed 1376

I have a webpack project with this in my "main.ts" module:

import {Elm} from "./MainModule";

it fails with:

TS2307: Cannot find module './MainModule'.

but when I switch my "tsconfig.json" from "module": "esnext" to "module": "commonjs", it works.

However, I need "esnext" in order to have code splitting.

Thoughts?

1 Answers
Related