I have project where there are two different js bundles served to the user. If the user is logged in bundle B
is served and if the user is not logged in, user is served bundle A
. I also have an index.html page where the bundle A
is injected like below.
<script
type="text/javascript"
src="dist/A.js"
></script>
Bundle A
has code that is capable of making api calls to log the user in. Now, when the user logs in and gets response from the server, I want to serve bundle B
to the user using the same index.html
file. How can this be achieved?
My questions
- Can this be achieved? How?
- Even if this can be achieved, will bundle
A
still have effects afterB
is applied?