I have some PureScript code that looks like this
module Types.ScriptLookups2 where
import Prelude
require :: Unit
require = unit
and it gets compiled to the JavaScript code
// Generated by purs version 0.14.9
"use strict";
var Data_Unit = require("../Data.Unit/index.js");
var require = Data_Unit.unit;
module.exports = {
require: require
};
It seems, at least by default, webpack is not smart enough to redefine the earlier require
s and then leave the final one alone. What happens instead is that webpack doesn't touch the require
function at all, leading to errors because there is no require in the browser. Is there any webpack configuration I can do to fix this, or do I need to work around it by other means? Unfortunately in the real code, this comes from a dependency, so it's not as easy as renaming it and moving on.