angular-bootloader icon indicating copy to clipboard operation
angular-bootloader copied to clipboard

Question: How to even use this?

Open sandgupta23 opened this issue 6 years ago • 0 comments

I found this library while searching how to load my angular bundles with defer attribute. Even async is fine for me.

After spending 2+ hours on this library, I have an absolute zero idea how to make it work. I tried it in fresh project but no success.

Repo: https://github.com/goodmite/bootloader-not-working

I Created a fresh project and in main.ts did this. It did not work.

// platformBrowserDynamic().bootstrapModule(AppModule).catch(err => console.error(err))

  export function main() {
    return platformBrowserDynamic().bootstrapModule(AppModule);
  }
  bootloader(main); // this will bootstrap your app via main function

Result: No async scripts in index.html


 <!doctype html>

   <html lang="en">
   <head>
   <meta charset="utf-8">
   <title>AngularTest</title>
   <base href="/">
    
   <meta name="viewport" content="width=device-width, initial-scale=1">
   <link rel="icon" type="image/x-icon" href="favicon.ico">
   <link rel="stylesheet" href="styles.3ff695c00d717f2d2a11.css"></head>
   <body>
   <app-root></app-root>
   <script type="text/javascript" src="runtime.3ad3e88387299ab1fa63.js"></script><script type="text/javascript" src="polyfills.e254f6b9bf511460eb6d.js"></script><script type="text/javascript" src="main.f6e46af22b8eab9da529.js"></script></body>
   </html>

I have a few questions. All of these would be automatically answered if you could provide one basic repo which uses this library.

  1. How to use this? What is the MainModule in the ReadMe? Is it the root module or the feature module? I tried loading both with bootloader. No success.
  2. Does this work in angular cli projects?
  3. Does this work in projects which don't implement angular universal. I ask this because all of the tutorials for this library are in the context of angular universal.

sandgupta23 avatar Jan 26 '19 17:01 sandgupta23