backbone1.js
var backbone1=require('backbone');
window.backbone=backbone1;
backbone2.js
console.log(window.backbone===require('backbone'));
为什么条件返回false。不应该每次都返回相同的对象吗?
修改
的index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<script src="bundle1.js"></script><!--backbone1.js compiles to bundle1.js"-->
<script src="bundle2.js"></script><!--backbone2.js compiles to bundle2.js"-->
</body>
</html>