Skip to content

Conversation

@reifiedbeans
Copy link
Owner

Fixes #6

@reifiedbeans
Copy link
Owner Author

Build blocked on vitejs/vite#17836

@reifiedbeans
Copy link
Owner Author

Audited the other server middlewares used in Vite currently and determined that there shouldn't be any middleware other than CORS that this plugin should need to implement.

@reifiedbeans
Copy link
Owner Author

reifiedbeans commented Aug 10, 2024

Using the following code as a test sample, this change passes manual testing for resolution and CORS.

vite.config.ts

import { defineConfig } from "vite";
import serveStatic from "vite-plugin-serve-static";

export default defineConfig({
  plugins: [
    serveStatic([
      {
        pattern: /^\/test/,
        resolve: './test.json',
      },
    ]),
  ],
});

fetch.html

<!doctype html>
<html lang="en">
  <script>
    async function getTest() {
      const res = await fetch('http://localhost:5173/test');
      console.log(res);
    }
    void getTest();
  </script>
</html>

@reifiedbeans reifiedbeans marked this pull request as ready for review August 10, 2024 09:01
@reifiedbeans reifiedbeans merged commit 540b2a3 into main Aug 10, 2024
@reifiedbeans reifiedbeans deleted the cors-fallback-fix branch August 10, 2024 09:02
@github-actions
Copy link

🎉 This issue has been resolved in version 1.0.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Regression in 1.0.2 breaking matches

2 participants