serve.php 603 B

1234567891011121314151617
  1. <?php
  2. if(str_starts_with($_SERVER['REQUEST_URI'], '/main.js')) {
  3. header("Content-Type: text/javascript; charset=UTF-8");
  4. passthru('corepack yarn outputBundle');
  5. return true;
  6. } else if (str_starts_with($_SERVER['REQUEST_URI'], '/uppy.min.css')) {
  7. header("Content-Type: text/css; charset=UTF-8");
  8. if(readfile(exec('node -p \'require.resolve("uppy").replace((p=require("uppy/package.json")).main,p.style)\'')) === false) {
  9. http_response_code(404);
  10. echo 'Cannot find the CSS file, be sure to run the build command.';
  11. }
  12. return true;
  13. } else {
  14. return false;
  15. }