This commit is contained in:
Simon Priet
2021-09-05 22:53:58 +02:00
commit 9e2991e668
17888 changed files with 1263126 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
t.equal(
require("./shared")(), 1,
"the main app bundle can already use the shared library"
);
t.throws(function() {
require("./lazy");
}, "lazy bundle is not executed yet so the lazy module cannot be required yet");
// Use setTimeout as script loader simulator as in real use case this would be
// a call to one. Now we just let the rest of the source code string we build
// to execute.
setTimeout(function() {
// After lazy bundle is executed we can require the lazy.js module
require("./lazy");
t.equal(
require("./shared")(),3,
"lazy module was able to use shared code"
);
}, 1);

View File

@@ -0,0 +1,6 @@
var i = 0;
module.exports = function() {
return ++i;
};
// 175e62

View File

@@ -0,0 +1,9 @@
t.equal(
require("./shared")(),2,
"lazy.js can use the shared library"
);
t.equal(
require("not/real")(),1,
"lazy.js can use library code with arbitrary names"
);

View File

@@ -0,0 +1,6 @@
var i = 0;
module.exports = function() {
return ++i;
};
// 77aa70