mirror of https://github.com/webpack/webpack.git
Supplying extensions when constructing DllReferencePlugin
This commit is contained in:
parent
c948c81f3e
commit
be39508aa2
|
@ -3,5 +3,6 @@ console.log(require("../dll/a"));
|
||||||
|
|
||||||
console.log(require("beta/beta"));
|
console.log(require("beta/beta"));
|
||||||
console.log(require("beta/b"));
|
console.log(require("beta/b"));
|
||||||
|
console.log(require("beta/c"));
|
||||||
|
|
||||||
console.log(require("module"));
|
console.log(require("module"));
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
module.exports = "jsx";
|
|
@ -1,9 +1,12 @@
|
||||||
var path = require("path");
|
var path = require("path");
|
||||||
var webpack = require("../../");
|
var webpack = require("../../");
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
resolve: {
|
||||||
|
extensions: ['.js', '.jsx']
|
||||||
|
},
|
||||||
entry: {
|
entry: {
|
||||||
alpha: ["./alpha", "./a", "module"],
|
alpha: ["./alpha", "./a", "module"],
|
||||||
beta: ["./beta", "./b"]
|
beta: ["./beta", "./b", "./c"]
|
||||||
},
|
},
|
||||||
output: {
|
output: {
|
||||||
path: path.join(__dirname, "js"),
|
path: path.join(__dirname, "js"),
|
||||||
|
|
|
@ -45,7 +45,8 @@ DllReferencePlugin.prototype.apply = function(compiler) {
|
||||||
type: this.options.type,
|
type: this.options.type,
|
||||||
scope: this.options.scope,
|
scope: this.options.scope,
|
||||||
context: this.options.context || compiler.options.context,
|
context: this.options.context || compiler.options.context,
|
||||||
content: this.options.content || manifest.content
|
content: this.options.content || manifest.content,
|
||||||
|
extensions: this.options.extensions
|
||||||
}));
|
}));
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
};
|
};
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
module.exports = 'f';
|
|
@ -2,7 +2,10 @@ var path = require("path");
|
||||||
var webpack = require("../../../../");
|
var webpack = require("../../../../");
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
entry: ["./a", "./b", "./_d", "./_e"],
|
entry: ["./a", "./b", "./_d", "./_e", "./f"],
|
||||||
|
resolve: {
|
||||||
|
extensions: ['', '.js', '.jsx']
|
||||||
|
},
|
||||||
output: {
|
output: {
|
||||||
filename: "dll.js",
|
filename: "dll.js",
|
||||||
chunkFilename: "[id].dll.js",
|
chunkFilename: "[id].dll.js",
|
||||||
|
|
|
@ -7,6 +7,10 @@ it("should load a module from dll", function() {
|
||||||
require("dll/a").should.be.eql("a");
|
require("dll/a").should.be.eql("a");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("should load a module of non-default type without extension from dll", function() {
|
||||||
|
require("dll/f").should.be.eql("f");
|
||||||
|
});
|
||||||
|
|
||||||
it("should load an async module from dll", function() {
|
it("should load an async module from dll", function() {
|
||||||
require("dll/b")().then(function(c) {
|
require("dll/b")().then(function(c) {
|
||||||
c.should.be.eql({ default: "c" });
|
c.should.be.eql({ default: "c" });
|
||||||
|
|
|
@ -7,7 +7,8 @@ module.exports = {
|
||||||
manifest: require("../../../js/config/dll-plugin/manifest0.json"),
|
manifest: require("../../../js/config/dll-plugin/manifest0.json"),
|
||||||
name: "../0-create-dll/dll.js",
|
name: "../0-create-dll/dll.js",
|
||||||
scope: "dll",
|
scope: "dll",
|
||||||
sourceType: "commonjs2"
|
sourceType: "commonjs2",
|
||||||
|
extensions: ['.js', '.jsx']
|
||||||
})
|
})
|
||||||
]
|
]
|
||||||
}
|
}
|
Loading…
Reference in New Issue