forked from webpack/webpack
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix behavior and add a warning when trying to load an
initial chunk on demand
- Loading branch information
Showing
6 changed files
with
62 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/* | ||
MIT License http://www.opensource.org/licenses/mit-license.php | ||
Author Sean Larkin @thelarkinn | ||
*/ | ||
"use strict"; | ||
|
||
const WebpackError = require("./WebpackError"); | ||
|
||
module.exports = class AsyncDependencyToInitialChunkWarning extends WebpackError { | ||
constructor(chunkName, module, loc) { | ||
super(); | ||
|
||
this.name = "AsyncDependencyToInitialChunkWarning"; | ||
this.message = `It's not allowed to load an initial chunk on demand. The chunk name "${chunkName}" is already used by an entrypoint.`; | ||
this.module = module; | ||
this.origin = module; | ||
this.originLoc = loc; | ||
|
||
Error.captureStackTrace(this, this.constructor); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
it("should handle reference to entry chunk correctly", function(done) { | ||
import(/* webpackChunkName: "main" */"./module-a").then(function(result) { | ||
result.default.should.be.eql("ok"); | ||
done(); | ||
}).catch(function(e) { | ||
done(e); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export default "ok"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = [ | ||
[/It's not allowed to load an initial chunk on demand\. The chunk name "main" is already used by an entrypoint\./], | ||
]; |