Skip to content

Commit 53944e8

Browse files
authored
Merge pull request webpack#5160 from asmundg/fix-amd-deprecation-warning
Replace deprecated Chunk.modules usage
2 parents 6199454 + 0c4ab4a commit 53944e8

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

lib/AmdMainTemplatePlugin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class AmdMainTemplatePlugin {
1717
const mainTemplate = compilation.mainTemplate;
1818

1919
compilation.templatesPlugin("render-with-entry", (source, chunk, hash) => {
20-
const externals = chunk.modules.filter((m) => m.external);
20+
const externals = chunk.getModules().filter((m) => m.external);
2121
const externalsDepsArray = JSON.stringify(externals.map((m) =>
2222
typeof m.request === "object" ? m.request.amd : m.request
2323
));

test/AmdMainTemplatePlugin.test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ describe("AmdMainTemplatePlugin", () => {
6767
describe("with name", () => {
6868
beforeEach(() => {
6969
env.chunk = {
70-
modules: env.modulesListWithExternals
70+
getModules: () => env.modulesListWithExternals
7171
};
7272
env.eventBinding = setupPluginAndGetEventBinding("foo");
7373
});
@@ -82,7 +82,7 @@ describe("AmdMainTemplatePlugin", () => {
8282
describe("with external dependencies", () => {
8383
beforeEach(() => {
8484
env.chunk = {
85-
modules: env.modulesListWithExternals
85+
getModules: () => env.modulesListWithExternals
8686
};
8787
env.eventBinding = setupPluginAndGetEventBinding();
8888
});
@@ -101,7 +101,7 @@ describe("AmdMainTemplatePlugin", () => {
101101
};
102102
const noExternals = env.modulesListWithExternals.map((module) => Object.assign(module, externalFlag));
103103
env.chunk = {
104-
modules: noExternals
104+
getModules: () => env.modulesListWithExternals
105105
};
106106
env.eventBinding = setupPluginAndGetEventBinding();
107107
});

0 commit comments

Comments
 (0)