0

I've been converting a Webpack 1 application to version 2, mostly for the benefits of AOT compilation and tree-shaking. At present, the code compiles - but when I test it, the application crashes out because the Map class and its constructor can't be found. Since many modules make use of x = new Map() constructs, this is cramping my style.

Can anyone suggest why such a basic class wouldn't be included in the AOT build, please?

Grizzled
  • 101

1 Answers1

0

Map is a JavaScript built-in data structure, which has been added with ES6/ES2015. You're probably using a browser that doesn't support it (see Browser compatibility). If you want to make it available for browsers that don't support it natively, you have to include a polyfill such as Map from core-js.

Michael Jungo
  • 31,583
  • 3
  • 91
  • 84