This repository has been archived by the owner on May 29, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 512
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: refer to the
entrypoint
instead of the first module
(`module…
….identifier`) (#601)
- Loading branch information
1 parent
5286ab2
commit d5a1de2
Showing
8 changed files
with
51 additions
and
6 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
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,2 @@ | ||
require("./module")(); | ||
module.exports = "a\n"; |
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,2 @@ | ||
require("./module")(); | ||
module.exports = "b\n"; |
2 changes: 2 additions & 0 deletions
2
test/cases/string-export-with-optimize-module-order/expected/main.txt
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,2 @@ | ||
a | ||
b |
3 changes: 3 additions & 0 deletions
3
test/cases/string-export-with-optimize-module-order/loader.js
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 = function(source) { | ||
return source; | ||
} |
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 @@ | ||
module.exports = () => {}; |
26 changes: 26 additions & 0 deletions
26
test/cases/string-export-with-optimize-module-order/webpack.config.js
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,26 @@ | ||
import ExtractTextPlugin from '../../../src/index'; | ||
|
||
function moduleOrderOptimizer() { | ||
this.plugin("after-plugins", compiler => | ||
compiler.plugin("compilation", compilation => | ||
compilation.plugin("optimize-module-order", modules => { | ||
const index = modules.findIndex(module => module.rawRequest == "./module"); | ||
[modules[0], modules[index]] = [modules[index], modules[0]]; | ||
}))); | ||
} | ||
|
||
module.exports = { | ||
entry: ['./a', './b'], | ||
module: { | ||
loaders: [ | ||
{ | ||
test: /(a|b)\.js$/, | ||
use: ExtractTextPlugin.extract('./loader') | ||
}, | ||
], | ||
}, | ||
plugins: [ | ||
moduleOrderOptimizer, | ||
new ExtractTextPlugin('[name].txt'), | ||
], | ||
}; |