gitea源码

123456789101112131415161718192021222324
  1. // bootstrap module must be the first one to be imported, it handles webpack lazy-loading and global errors
  2. import './bootstrap.ts';
  3. import './webcomponents/index.ts';
  4. import {onDomReady} from './utils/dom.ts';
  5. // TODO: There is a bug in htmx, it incorrectly checks "readyState === 'complete'" when the DOM tree is ready and won't trigger DOMContentLoaded
  6. // Then importing the htmx in our onDomReady will make htmx skip its initialization.
  7. // If the bug would be fixed (https://github.com/bigskysoftware/htmx/pull/3365), then we can only import htmx in "onDomReady"
  8. import 'htmx.org';
  9. onDomReady(async () => {
  10. // when navigate before the import complete, there will be an error from webpack chunk loader:
  11. // JavaScript promise rejection: Loading chunk index-domready failed.
  12. try {
  13. await import(/* webpackChunkName: "index-domready" */'./index-domready.ts');
  14. } catch (e) {
  15. if (e.name === 'ChunkLoadError') {
  16. console.error('Error loading index-domready:', e);
  17. } else {
  18. throw e;
  19. }
  20. }
  21. });