Skip to content

Commit

Permalink
fix: chunk modules test on windows (#4894)
Browse files Browse the repository at this point in the history
  • Loading branch information
ahabhgk authored Dec 5, 2023
1 parent 437ad29 commit e115177
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ it("chunk-modules", async () => {
const data = JSON.parse(
await fs.promises.readFile(path.join(__dirname, "data.json"), "utf-8")
);
expect(data.main.modules).toContain("/index.js");
expect(data.main.entryModules).toContain("/index.js");
expect(data.async.modules).toContain("/async.js");
expect(data.main.modules.length).toBe(3);
expect(data.main.entryModules.length).toBe(1);
expect(data.async.modules.length).toBe(1);
expect(data.async.entryModules.length).toBe(0);
});
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,10 @@ module.exports = {
compilation.hooks.processAssets.tap("plugin", () => {
const chunkModules = {};
for (let chunk of compilation.chunks) {
const modules = compilation.chunkGraph
.getChunkModulesIterable(chunk)
.map(m => m.identifier().slice(compiler.context.length));
const entryModules = compilation.chunkGraph
.getChunkEntryModulesIterable(chunk)
.map(m => m.identifier().slice(compiler.context.length));
const modules =
compilation.chunkGraph.getChunkModulesIterable(chunk);
const entryModules =
compilation.chunkGraph.getChunkEntryModulesIterable(chunk);
chunkModules[chunk.id] = { modules, entryModules };
}
compilation.emitAsset(
Expand Down

0 comments on commit e115177

Please sign in to comment.