Rajasekar
Rajasekar

Reputation: 18948

How to add defer attribute to the bundle generated using webpack

We are bundling our react application using webpack. and it generates a bundle which is injected using script tag

<script src="/js/main.bundle.c02b9dc1468b4bf6c7e3.js"></script>

This main.bundle size is big, that it affects performance. The suggestion is that to make this js bundle to load defer / async.

<script defer src="/js/main.bundle.c02b9dc1468b4bf6c7e3.js"></script>

How to add defer attribute to the script tag. Since this script tag is injected dynamically by webpack, i am not able to find it anywhere in my application.

Upvotes: 0

Views: 1049

Answers (0)

Related Questions