4

Our project was using: "builder": @angular-builders/custom-webpack:browser for our build. In our webpack.config.js we have this plugin:

 /**
     * report-result.js cannot be tree-shaked as part of the bundling process, since it actually runs as an global script.
     * an empty stub file will be used to help reduce bundle size and improvement performance.
     */
    new webpack.NormalModuleReplacementPlugin(
        /(.*)proto\/report-result(.*)/,
        function (resource) {
            if (targetOptions.configuration === 'production') {                    
                resource.request = resource.request.replace(
                    /report-result/,
                    'report-result-stub',
                );
            }
        },
    ),

Now we have migrated to Angular 17 and want to use the deafault Angular CLI with this: "builder": "@angular-devkit/build-angular:application" (which is esbuild).

The question is, how can we achive the same functionality as we have in our webpack NormalModuleReplacementPlugin ?

As far as I can see, Angular does not allow you to customize esbuild or use plugins at all.

Thanks!

1
  • any news for this question ? Commented Nov 12, 2024 at 13:30

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.