-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Closed
Labels
Description
Discussed in #17902
Originally posted by hardfist December 28, 2023
I'm not sure whether it's by design or bug, it seems outputModule relys on setting optimization.providedExports to true, otherwise it wouldn't generate the export statement
you can reproduce here https://github.com/web-infra-dev/rspack-repro/tree/esm-output
- optimization.providedExports=true
const external_react_namespaceObject = x({ ["default"]: () => __WEBPACK_EXTERNAL_MODULE_react__["default"] });
;// CONCATENATED MODULE: ./src/index.js
console.log({React: external_react_namespaceObject["default"]});
var __webpack_exports__React = __webpack_exports__._;
export { __webpack_exports__React as React };- optimization.providedExports = false
var __webpack_exports__ = {};
;// CONCATENATED MODULE: external "react"
var x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
var y = x => () => x
const external_react_namespaceObject = x({ ["default"]: () => __WEBPACK_EXTERNAL_MODULE_react__["default"] });
;// CONCATENATED MODULE: ./src/index.js
console.log({React: external_react_namespaceObject["default"]});
// missing the export statement
```</div>Reactions are currently unavailable