fixed little bug
This commit is contained in:
parent
b5f7c36a29
commit
55149353d4
|
@ -16,7 +16,7 @@ module.exports = NodeStuffPlugin;
|
||||||
NodeStuffPlugin.prototype.apply = function(compiler) {
|
NodeStuffPlugin.prototype.apply = function(compiler) {
|
||||||
function ignore() { return true; }
|
function ignore() { return true; }
|
||||||
var context = this.context;
|
var context = this.context;
|
||||||
if(this.options.__filename) {
|
if(this.options.__filename == "mock") {
|
||||||
compiler.parser.plugin("expression __filename", function(expr) {
|
compiler.parser.plugin("expression __filename", function(expr) {
|
||||||
this.state.current.addVariable("__filename", JSON.stringify("/index.js"));
|
this.state.current.addVariable("__filename", JSON.stringify("/index.js"));
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -1,31 +0,0 @@
|
||||||
/*
|
|
||||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
|
||||||
Author Tobias Koppers @sokra
|
|
||||||
*/
|
|
||||||
var path = require("path");
|
|
||||||
|
|
||||||
function NodeStuffRealPathsPlugin(context, onlyIfInContext) {
|
|
||||||
this.context = context;
|
|
||||||
this.onlyIfInContext = onlyIfInContext;
|
|
||||||
}
|
|
||||||
module.exports = NodeStuffRealPathsPlugin;
|
|
||||||
NodeStuffRealPathsPlugin.prototype.apply = function(compiler) {
|
|
||||||
var context = this.context;
|
|
||||||
var onlyIfInContext = this.onlyIfInContext;
|
|
||||||
compiler.parser.plugin("expression __filename", function(expr) {
|
|
||||||
if(!this.state.module) return;
|
|
||||||
if(onlyIfInContext && this.state.module.resource.indexOf(context) != 0) return;
|
|
||||||
this.state.current.addVariable("__filename", JSON.stringify(
|
|
||||||
context ? path.relative(context, this.state.module.resource) : this.state.module.resource
|
|
||||||
));
|
|
||||||
return true;
|
|
||||||
});
|
|
||||||
compiler.parser.plugin("expression __dirname", function(expr) {
|
|
||||||
if(!this.state.module) return;
|
|
||||||
if(onlyIfInContext && this.state.module.context.indexOf(context) != 0) return;
|
|
||||||
this.state.current.addVariable("__dirname", JSON.stringify(
|
|
||||||
context ? path.relative(context, this.state.module.context) : this.state.module.context
|
|
||||||
));
|
|
||||||
return true;
|
|
||||||
});
|
|
||||||
};
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "webpack",
|
"name": "webpack",
|
||||||
"version": "0.10.0-beta13",
|
"version": "0.10.0-beta14",
|
||||||
"author": "Tobias Koppers @sokra",
|
"author": "Tobias Koppers @sokra",
|
||||||
"description": "Packs CommonJs/AMD/Labeled Modules for the browser. Allows to split your codebase into multiple bundles, which can be loaded on demand. Support loaders to preprocess files, i.e. json, jade, coffee, css, less, ... and your custom stuff.",
|
"description": "Packs CommonJs/AMD/Labeled Modules for the browser. Allows to split your codebase into multiple bundles, which can be loaded on demand. Support loaders to preprocess files, i.e. json, jade, coffee, css, less, ... and your custom stuff.",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|
Loading…
Reference in New Issue