I am trying to move my webEngage script into another file, so I can pass it as an entry point in my webpack. Here is what I already have in my index.ejs
<head>
<meta charset="utf-8" />
<meta
name="viewport"
content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0"
/>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
</head>
<body>
<!-- ICONS SPRITE -->
<div style="display: none">
<% if (htmlWebpackPlugin.files.sprites) { for (var spriteFileName in
htmlWebpackPlugin.files.sprites) { %> <%=
htmlWebpackPlugin.files.sprites[spriteFileName] %> <% } } %>
</div>
<div id="root"></div>
<noscript>
scripts is disabled, please enable javascript and try again!
</noscript>
<!-- WebEngage Script -->
<script id="_webengage_script_tag" type="text/javascript">
var webengage;
!(function(w, e, b, n, g) {
function o(e, t) {
e[t[t.length - 1]] = function() {
r.__queue.push([t.join('.'), arguments]);
};
}
.
.
.
})(window, document, 'webengage');
</body>
I was thinking of declaring an IIFE in a scripts.js file, but it didn't work. I would appreciate your help in advance