Skip to content

Commit 30d7f42

Browse files
committed
remove Webpack not found dynamic require injection
1 parent ee694f7 commit 30d7f42

File tree

2 files changed

+0
-85
lines changed

2 files changed

+0
-85
lines changed

src/index.js

-30
Original file line numberDiff line numberDiff line change
@@ -179,36 +179,6 @@ module.exports = (
179179
if (err) console.error(err);
180180
assetState.assetPermissions = JSON.parse(_assetPermissions || 'null') || Object.create(null);
181181
}); */
182-
// hack to ensure __webpack_require__ is added to empty context wrapper
183-
compilation.hooks.additionalModuleRuntimeRequirements.tap("ncc", (module, runtimeRequirements) => {
184-
if(module._contextDependencies)
185-
runtimeRequirements.add('__webpack_require__');
186-
});
187-
compilation.moduleTemplates.javascript.hooks.render.tap(
188-
"ncc",
189-
(
190-
moduleSourcePostModule,
191-
module,
192-
options,
193-
dependencyTemplates
194-
) => {
195-
if (
196-
module._contextDependencies &&
197-
moduleSourcePostModule._value.match(
198-
/webpackEmptyAsyncContext|webpackEmptyContext/
199-
)
200-
) {
201-
return moduleSourcePostModule._value.replace(
202-
"var e = new Error",
203-
`if (typeof req === 'number')\n` +
204-
` return __webpack_require__(req);\n` +
205-
`try { return require(req) }\n` +
206-
`catch (e) { if (e.code !== 'MODULE_NOT_FOUND') throw e }\n` +
207-
`var e = new Error`
208-
);
209-
}
210-
}
211-
);
212182
});
213183

214184
compiler.hooks.normalModuleFactory.tap("ncc", NormalModuleFactory => {

test/unit/asset-fs-inline-path-rel/output.js

-55
This file was deleted.

0 commit comments

Comments
 (0)