updated npm modules
This commit is contained in:
64
node_modules/webpack/lib/NodeStuffPlugin.js
generated
vendored
64
node_modules/webpack/lib/NodeStuffPlugin.js
generated
vendored
@@ -58,38 +58,42 @@ class NodeStuffPlugin {
|
||||
});
|
||||
};
|
||||
const context = compiler.context;
|
||||
if (localOptions.__filename === "mock") {
|
||||
setConstant("__filename", "/index.js");
|
||||
} else if (localOptions.__filename) {
|
||||
setModuleConstant("__filename", module =>
|
||||
path.relative(context, module.resource)
|
||||
);
|
||||
if (localOptions.__filename) {
|
||||
if (localOptions.__filename === "mock") {
|
||||
setConstant("__filename", "/index.js");
|
||||
} else {
|
||||
setModuleConstant("__filename", module =>
|
||||
path.relative(context, module.resource)
|
||||
);
|
||||
}
|
||||
parser.hooks.evaluateIdentifier
|
||||
.for("__filename")
|
||||
.tap("NodeStuffPlugin", expr => {
|
||||
if (!parser.state.module) return;
|
||||
const resource = parser.state.module.resource;
|
||||
const i = resource.indexOf("?");
|
||||
return ParserHelpers.evaluateToString(
|
||||
i < 0 ? resource : resource.substr(0, i)
|
||||
)(expr);
|
||||
});
|
||||
}
|
||||
parser.hooks.evaluateIdentifier
|
||||
.for("__filename")
|
||||
.tap("NodeStuffPlugin", expr => {
|
||||
if (!parser.state.module) return;
|
||||
const resource = parser.state.module.resource;
|
||||
const i = resource.indexOf("?");
|
||||
return ParserHelpers.evaluateToString(
|
||||
i < 0 ? resource : resource.substr(0, i)
|
||||
)(expr);
|
||||
});
|
||||
if (localOptions.__dirname === "mock") {
|
||||
setConstant("__dirname", "/");
|
||||
} else if (localOptions.__dirname) {
|
||||
setModuleConstant("__dirname", module =>
|
||||
path.relative(context, module.context)
|
||||
);
|
||||
if (localOptions.__dirname) {
|
||||
if (localOptions.__dirname === "mock") {
|
||||
setConstant("__dirname", "/");
|
||||
} else {
|
||||
setModuleConstant("__dirname", module =>
|
||||
path.relative(context, module.context)
|
||||
);
|
||||
}
|
||||
parser.hooks.evaluateIdentifier
|
||||
.for("__dirname")
|
||||
.tap("NodeStuffPlugin", expr => {
|
||||
if (!parser.state.module) return;
|
||||
return ParserHelpers.evaluateToString(
|
||||
parser.state.module.context
|
||||
)(expr);
|
||||
});
|
||||
}
|
||||
parser.hooks.evaluateIdentifier
|
||||
.for("__dirname")
|
||||
.tap("NodeStuffPlugin", expr => {
|
||||
if (!parser.state.module) return;
|
||||
return ParserHelpers.evaluateToString(
|
||||
parser.state.module.context
|
||||
)(expr);
|
||||
});
|
||||
parser.hooks.expression
|
||||
.for("require.main")
|
||||
.tap(
|
||||
|
||||
Reference in New Issue
Block a user