Unverified Commit 96389f20 authored by Robert Knight's avatar Robert Knight Committed by GitHub

Merge pull request #1552 from hypothesis/fix-external-require-reference

Fix module load error on pages defining `require`
parents 1eff5f68 3f9bc92d
......@@ -135,8 +135,8 @@ module.exports = function createBundle(config, buildOpts) {
.readFileSync(defaultPreludePath)
.toString()
.replace(
'var previousRequire = typeof require == "function" && require;',
`var previousRequire = typeof ${externalRequireName} == "function" && ${externalRequireName};`
/typeof require == "function" && require/g,
`typeof ${externalRequireName} == "function" && ${externalRequireName};`
);
if (!prelude.includes(externalRequireName)) {
throw new Error(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment