janv / webpack-esm-runtimechunk-error

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

This repo is a minimal reproducible example of a bug in webpack that happens when combining ESM library output with runtimeChunk: single.

See webpack/webpack#2933 (comment)

  • Build the project with yarn build
  • Terser will complain about an export appearing in a location that's not the toplevel of a module.

The generated code that Terser chokes on looks like this:

(__webpack_require__) => {
  var __webpack_exec__ = (moduleId) =>
    __webpack_require__((__webpack_require__.s = moduleId));
  var __webpack_exports__ = __webpack_exec__(533);
  var __webpack_exports__default = __webpack_exports__.Z;
  export { __webpack_exports__default as default };
};

About


Languages

Language:JavaScript 100.0%