0

I have few angular libraries in my angular project. We will rollup all the files contains code related to my components, services, libraries and generate a loader file. Also there is a libs file that is generated using rollup with all the third party libraries. These two libs.js and loader.js files will be used in the index.html to load it as a webapp.

After migrating to angular 13 ivy, it is generating esm modules with .mjs file extensions. I tried to combine all the .mjs files and tried to generate a loader.mjs file now.

Also add script with


<script type="module" src="libs.mjs" ></script>  
<script type="module" src="loader.mjs" ></script>

this throws error on running the webapp as identifiers has already been declared. I had combined all the files into single file and it is not possible to resolve these issues in the combined file. I end up resolving each issue in every file. enter image description here

How to handle using .mjs files ? Is this a proper approach? I need to convert .mjs back to .js files and work with .js files as I was doing before ?

bvakiti
  • 3,243
  • 4
  • 17
  • 26

0 Answers0