fixes #20
This commit is contained in:
parent
8233cb9c13
commit
c6520db2bd
|
@ -1,7 +1,9 @@
|
||||||
module.exports = function(module) {
|
module.exports = function(module) {
|
||||||
if(!module.webpackPolyfill) {
|
if(!module.webpackPolyfill) {
|
||||||
module.deprecate = function() {};
|
module.deprecate = function() {};
|
||||||
module.id = "webpack";
|
module.paths = [];
|
||||||
|
// module.parent = undefined by default
|
||||||
|
module.children = [];
|
||||||
module.webpackPolyfill = 1;
|
module.webpackPolyfill = 1;
|
||||||
}
|
}
|
||||||
return module;
|
return module;
|
||||||
|
|
|
@ -522,7 +522,7 @@ function walkExpression(context, expression) {
|
||||||
if(expression.object.type === "Identifier" &&
|
if(expression.object.type === "Identifier" &&
|
||||||
expression.object.name === "module" &&
|
expression.object.name === "module" &&
|
||||||
expression.property.type === "Identifier" &&
|
expression.property.type === "Identifier" &&
|
||||||
expression.property.name === "exports")
|
{exports:1, id:1, loaded:1}.hasOwnProperty(expression.property.name))
|
||||||
break;
|
break;
|
||||||
if(expression.object.type === "Identifier" &&
|
if(expression.object.type === "Identifier" &&
|
||||||
expression.object.name === "require" &&
|
expression.object.name === "require" &&
|
||||||
|
|
|
@ -6,9 +6,12 @@
|
||||||
/******/ if(installedModules[moduleId])
|
/******/ if(installedModules[moduleId])
|
||||||
/******/ return installedModules[moduleId].exports;
|
/******/ return installedModules[moduleId].exports;
|
||||||
/******/ var module = installedModules[moduleId] = {
|
/******/ var module = installedModules[moduleId] = {
|
||||||
/******/ exports: {}
|
/******/ exports: {},
|
||||||
|
/******/ id: moduleId,
|
||||||
|
/******/ loaded: false
|
||||||
/******/ };
|
/******/ };
|
||||||
/******/ modules[moduleId](module, module.exports, require);
|
/******/ modules[moduleId](module, module.exports, require);
|
||||||
|
/******/ module.loaded = true;
|
||||||
/******/ return module.exports;
|
/******/ return module.exports;
|
||||||
/******/ }
|
/******/ }
|
||||||
/******/ require.e = function(chunkId, callback) {
|
/******/ require.e = function(chunkId, callback) {
|
||||||
|
|
|
@ -5,9 +5,12 @@
|
||||||
/******/ if(installedModules[moduleId])
|
/******/ if(installedModules[moduleId])
|
||||||
/******/ return installedModules[moduleId].exports;
|
/******/ return installedModules[moduleId].exports;
|
||||||
/******/ var module = installedModules[moduleId] = {
|
/******/ var module = installedModules[moduleId] = {
|
||||||
/******/ exports: {}
|
/******/ exports: {},
|
||||||
|
/******/ id: moduleId,
|
||||||
|
/******/ loaded: false
|
||||||
/******/ };
|
/******/ };
|
||||||
/******/ modules[moduleId](module, module.exports, require);
|
/******/ modules[moduleId](module, module.exports, require);
|
||||||
|
/******/ module.loaded = true;
|
||||||
/******/ return module.exports;
|
/******/ return module.exports;
|
||||||
/******/ }
|
/******/ }
|
||||||
/******/ require.e = function(chunkId, callback) {
|
/******/ require.e = function(chunkId, callback) {
|
||||||
|
|
|
@ -61,7 +61,6 @@ require.ensure([], function(require) {
|
||||||
window.test(contextRequire("./singluar").value === 2, "Context works in chunk");
|
window.test(contextRequire("./singluar").value === 2, "Context works in chunk");
|
||||||
var singl = "singl";
|
var singl = "singl";
|
||||||
window.test(require("." + "/" + singl + "uar").value === 2, "Context works in chunk, when splitted");
|
window.test(require("." + "/" + singl + "uar").value === 2, "Context works in chunk, when splitted");
|
||||||
window.test(typeof module.id === "string", "module.id should be a string");
|
|
||||||
window.test(process.argv && process.argv.length > 1, "process.argv should be an array");
|
window.test(process.argv && process.argv.length > 1, "process.argv should be an array");
|
||||||
process.nextTick(function() {
|
process.nextTick(function() {
|
||||||
sum2++;
|
sum2++;
|
||||||
|
@ -80,6 +79,8 @@ require.ensure([], function(require) {
|
||||||
window.test(module === 1233, "overwrite module via variable should be ok");
|
window.test(module === 1233, "overwrite module via variable should be ok");
|
||||||
}());
|
}());
|
||||||
});
|
});
|
||||||
|
window.test(typeof module.id === "number", "module.id should be a number");
|
||||||
|
window.test(module.id === require.resolve("./index.web.js"), "module.id should be a id of the module");
|
||||||
|
|
||||||
require.ensure([], function(require) {
|
require.ensure([], function(require) {
|
||||||
require("./acircular");
|
require("./acircular");
|
||||||
|
|
Loading…
Reference in New Issue