Do you want to request a feature or report a bug?
Bug
What is the current behavior?
The code snippet should work as expected, I think. But in fact, it's not work as expected when i using Identifier instead of Literal.
var regexp = /^\.\/.*\.js$/;
var req = require.context("./templates", false, regexp); // Uncaught Error
var bool = false;
var req = require.context("./templates", bool, /^\.\/.*\.js$/); // Uncaught Error
var dir = "./templates";
var req = require.context(dir, false, /^\.\/.*\.js$/); // Uncaught Error
If the current behavior is a bug, please provide the steps to reproduce.
main.js (or anywhere in javascript files)
var regexp = /^\.\/.*\.js$/;
var req = require.context("./templates", false, regexp); // Uncaught Error
This code above the line can reproduce the bug.
What is the expected behavior?
No Error. When i use Identifier instead of Literal.
Please mention other relevant information such as the browser version, Node.js version, webpack
version and Operating System.
Max OS X 10.12
Node 7.8.0
webpack 1.x 2.x
FYI, I found the return value at L17 in lib/dependencies/RequireContextDependencyParserPlugin.js file is wrong, the expected type is a RegExp, But it's not in fact.
Further info, something about evaluate in Parser.js, for example:
this.plugin("evaluate Identifier", function(expr) {
//...
if(this.scope.definitions.indexOf(expr.name) === -1) {
//...
} else {
return this.applyPluginsBailResult1("evaluate defined Identifier " + name, expr);
}
});
But I don't find this.plugin("evaluate defined Identifier", function(expr) {...});, am i missing something?
Do you want to request a feature or report a bug?
Bug
What is the current behavior?
The code snippet should work as expected, I think. But in fact, it's not work as expected when i using Identifier instead of Literal.
If the current behavior is a bug, please provide the steps to reproduce.
main.js (or anywhere in javascript files)
This code above the line can reproduce the bug.
What is the expected behavior?
No Error. When i use Identifier instead of Literal.
Please mention other relevant information such as the browser version, Node.js version, webpack
version and Operating System.
Max OS X 10.12
Node 7.8.0
webpack 1.x 2.x
FYI, I found the return value at L17 in lib/dependencies/RequireContextDependencyParserPlugin.js file is wrong, the expected type is a RegExp, But it's not in fact.
Further info, something about evaluate in Parser.js, for example:
But I don't find
this.plugin("evaluate defined Identifier", function(expr) {...});, am i missing something?