diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 094e5b90..6fd0138b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,6 +27,7 @@ jobs: - uses: ./.github/actions/prepare-rspack-binding with: path: ${{ env.RSPACK_DIR }} + ref: pull/8470/head bench: needs: prepare-binding @@ -45,6 +46,7 @@ jobs: - uses: ./.github/actions/build-rspack with: path: ${{ env.RSPACK_DIR }} + ref: pull/8470/head - name: Run benchmark run: node bin/cli.js bench --shard ${{ matrix.shardIndex }}/${{ matrix.shardTotal }} - id: print-compare-results diff --git a/lib/addons/traverse-module-graph/index.js b/lib/addons/traverse-module-graph/index.js index 80cef20b..3e8cc127 100644 --- a/lib/addons/traverse-module-graph/index.js +++ b/lib/addons/traverse-module-graph/index.js @@ -1,6 +1,9 @@ import path from "path"; +import url from "url"; import { Addon } from "../common.js"; +const __dirname = path.dirname(url.fileURLToPath(import.meta.url)); + export default class extends Addon { options = { times: 10 @@ -10,7 +13,7 @@ export default class extends Addon { ctx.config + ` module.exports.plugins = module.exports.plugins || []; -const TraverseModuleGraphPlugin = require("${path.join(__dirname, 'plugin.js')}"); +const TraverseModuleGraphPlugin = require("${path.join(__dirname, 'plugin.cjs')}"); module.exports.plugins.push(new TraverseModuleGraphPlugin()); `; } diff --git a/lib/addons/traverse-module-graph/plugin.js b/lib/addons/traverse-module-graph/plugin.cjs similarity index 92% rename from lib/addons/traverse-module-graph/plugin.js rename to lib/addons/traverse-module-graph/plugin.cjs index 9fc9218c..4b2efe31 100644 --- a/lib/addons/traverse-module-graph/plugin.js +++ b/lib/addons/traverse-module-graph/plugin.cjs @@ -11,6 +11,9 @@ class TraverseModuleGraphPlugin { function traverse(dependency) { const module = compilation.moduleGraph.getModule(dependency); if (module) { + if (visitedModules.has(module)) { + return; + } visitedModules.add(module); for (const dep of module.dependencies) { traverse(dep)