improve: js boilerplate

This commit is contained in:
Kelly Mears
2022-12-23 10:53:52 -08:00
parent f4474ecb00
commit fe2885dd9e
2 changed files with 14 additions and 30 deletions

View File

@@ -1,21 +1,13 @@
import {domReady} from '@roots/sage/client';
import { domReady } from '@roots/sage/client';
/**
* app.main
* Application entrypoint
*/
const main = async (err) => {
if (err) {
// handle hmr errors
console.error(err);
}
// application code
};
domReady(async () => {
// ...
});
/**
* Initialize
*
* @see https://webpack.js.org/api/hot-module-replacement
* @see {@link https://webpack.js.org/api/hot-module-replacement/}
*/
domReady(main);
import.meta.webpackHot?.accept(main);
import.meta.webpackHot?.accept(console.error);