statics-setup.tsx 942 B

123456789101112131415161718192021
  1. /* eslint no-native-reassign:0 */
  2. // eslint-disable-next-line no-var
  3. declare var __webpack_public_path__: string;
  4. /**
  5. * Set the webpack public path at runtime. This is necessary so that imports
  6. * can be resolved properly
  7. *
  8. * NOTE: This MUST be loaded before any other app modules in the entrypoint.
  9. *
  10. * This may not be as necessary without versioned asset URLs. (Rather, instead of a version directory
  11. * that is generated on backend, frontend assets will be "versioned" by webpack with a content hash in
  12. * its filename). This means that the public path does not need to be piped from the backend.
  13. *
  14. * XXX(epurkhiser): Currently we only boot with hydration in experimental SPA
  15. * mode, where assets are *currently not versioned*. We hardcode `/_assets/` here
  16. * for now as a quick workaround for the index.html being aware of versioned
  17. * asset paths.
  18. */
  19. __webpack_public_path__ = window.__initialData?.distPrefix || '/_assets/';