mirror of https://github.com/webpack/webpack.git
fix: add missed __webpack_require__.e runtime while importing exist module with context
This commit is contained in:
parent
87a3046eb7
commit
7edcc480db
|
|
@ -250,7 +250,14 @@ module.exports = class MainTemplate extends Tapable {
|
|||
} else if (
|
||||
chunk.hasModuleInGraph(m =>
|
||||
m.blocks.some(b => b.chunkGroup && b.chunkGroup.chunks.length > 0)
|
||||
)
|
||||
) ||
|
||||
chunk
|
||||
.getModules()
|
||||
.some(m =>
|
||||
m.dependencies.some(
|
||||
dep => dep.type && dep.type.startsWith("import()")
|
||||
)
|
||||
)
|
||||
) {
|
||||
// There async blocks in the graph, so we need to add an empty requireEnsure
|
||||
// function anyway. This can happen with multiple entrypoints.
|
||||
|
|
|
|||
|
|
@ -0,0 +1 @@
|
|||
export default "initialModuleDefault";
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
it("should resolve when import existed chunk (#8626)", function(done) {
|
||||
require.context("./dir-initial/");
|
||||
const fileName = "initialModule";
|
||||
import(`./dir-initial/${fileName}`).then(({default:m}) => {
|
||||
expect(m).toBe("initialModuleDefault");
|
||||
done();
|
||||
}).catch(done);
|
||||
});
|
||||
Loading…
Reference in New Issue