Skip to content

onBuildStart scripts runs multiple times #53

@rm-arun-kumar

Description

@rm-arun-kumar

Hi,
I’m running some scripts with this plugin using the onBeforeBuild, onBuildStart, and onBuildEnd hooks on build process. I’ve noticed that the pre-build scripts execute multiple times regardless. I have recursive function inside node ./build/scripts/cleanupTemp.js task. If onBuildStart has more than one task, the issue occurs

My config:

plugins: [
            // Other configs
            new WebpackShellPluginNext({
                onBeforeBuild: {
                    scripts: [
                        'echo "NPM version => $(npm -v)"',
                        'echo "Node version => $(node -v)"'
                    ]
                },
                onBuildStart: {
                    scripts: [
                        'echo "Webpack Start"',
                        'node ./build/scripts/cleanupTemp.js'
                    ]
                },
                onBuildEnd: {
                    scripts: [
                        'echo "Webpack End"',
                        'node ./build/scripts/postBuild.js',
                        'node ./build/entryLoad.js',
                    ],
                    blocking: true
                }
            }),
   //  Other configs 

Log:

Image

Package version: Tested with 2.2.2 and the latest 2.3.3 → same issue.

I have tried with node v22.11.0 and v24.5.0 versions.!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions