wrangler-pages-functions-dev
TypeScript icon, indicating that this package has built-in type declarations

0.0.7 • Public • Published

wrangler-pages-functions-dev

wrangler-pages-functions-dev is a Vite plugin that can be used to handle Cloudflare Pages Functions during local development.

It can be useful for example when working on a single page application that makes use of Pages Functions.

Usage

Install the package as a dev dependency alongside wrangler:

npm i -D wrangler-pages-functions-dev wrangler

To use the plugin with vite dev simply update your vite config file to include the plugin and to specify which routes it should handle, for example:

export default defineConfig({
  plugins: [
+    wranglerPagesFunctionsDev({
+      matchRoutes: /api/,
+    }),
    // ...
  ],
})

You can preview or deploy you application with wrangler pages in the same exact way as you would without this plugin (this plugin only effects vite dev everything else works exactly the same as it would otherwise).

Examples

  • React SPA hello-world example
    Very minimalistic example that shows how this plugin can be used to locally developer a react SPA applications alongside Pages Functions.

Package Sidebar

Install

npm i wrangler-pages-functions-dev

Weekly Downloads

1

Version

0.0.7

License

MIT

Unpacked Size

79.6 kB

Total Files

5

Last publish

Collaborators

  • dario.piotrowicz