Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

106
Views
Dynamic Import using async await inside domReady

I’m really sorry for this question. I’m not so familiar with async await but I’m still learning how to use it properly. I just want to ask if this is the correct way to add dynamic import inside domready? Or do I need to place it outside const main? I just follow the sample here: https://github.com/roots/sage/blob/main/resources/scripts/app.js

import { domReady } from '@roots/sage/client';
const main = async (err) => {
  if (err) {
    // handle hmr errors
    console.error(err);
  }
  
  (async() => {
    const conditionalScript = await import('./home.js');
    conditionalScript.test();
  })();

  // $win.on('resize', function () {
    
  // });
};

domReady(main);

import.meta.webpackHot?.accept(main);
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!