Webpack will try to bundle modules during compile time and replace the original require, so using require directly in the Webpack context to load configs could result in MODULE_NOT_FOUND error. Switching to __non_webpack_require__ to use plain require while in the Webpack environment.
close https://github.com/sindresorhus/import-fresh/issues/21
Credit: Thanks @jeremiegirault for proposing the changes in https://github.com/sindresorhus/import-fresh/issues/21
Description
Webpack will try to bundle modules during compile time and replace the original
require
, so usingrequire
directly in the Webpack context to load configs could result inMODULE_NOT_FOUND
error. Switching to__non_webpack_require__
to use plainrequire
while in the Webpack environment.About
__non_webpack_require__
:Try to solve issues like:
Test
npm run test