-
Notifications
You must be signed in to change notification settings - Fork 41
Open
Description
When importing into an esm module:
(node:29176) UnhandledPromiseRejectionWarning: ReferenceError: require is not defined in ES module scope, you can use import instead
at file:///<...>/node_modules/error-overlay-webpack-plugin/dist/index.mjs:1:32
The index.mjs file is implemented as:
const errorOverlayMiddleware = require("react-dev-utils/errorOverlayMiddleware");
const chunkPathBasic = require.resolve("./entries/basic.mjs");
const chunkPathDevServer = require.resolve("./entries/devserver.mjs");
This seems like an invalid import. I don't think it is related to #93, as this appears to be updating .cjs files, rather than .mjs.
For my workaround, in my webpack I have created a shim error-overlay-shim.js file that to force the import of eowp as cjs
//
// The MJS exports of error-overlay use require, and aren't valid
// in a module. Shimming with a .js file forces us to import cjs version
const ErrorOverlayPlugin = require('error-overlay-webpack-plugin')
module.exports = ErrorOverlayPlugin;
romaleev and talkohavy
Metadata
Metadata
Assignees
Labels
No labels