Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
hi-ogawa committed Apr 12, 2024
1 parent 9fbb24a commit ee5688b
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
11 changes: 11 additions & 0 deletions examples/react-server/src/routes/_action.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
"use action";

let count = 0;

export function getCounter() {
return count;
}

export function changeCounter(formData: FormData) {
formData;
}
12 changes: 12 additions & 0 deletions examples/react-server/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,12 @@ function vitePluginServerAction(): PluginOption {
*/
const clientTransform: Plugin = {
name: vitePluginServerAction.name + ":client",
transform(code, id, _options) {
if (this.environment?.name !== "react-server") {
code;
id;
}
},
};

/*
Expand All @@ -291,6 +297,12 @@ function vitePluginServerAction(): PluginOption {
*/
const serverTransform: Plugin = {
name: vitePluginServerAction.name + ":server",
transform(code, id, _options) {
if (this.environment?.name === "react-server") {
code;
id;
}
},
};

/*
Expand Down

0 comments on commit ee5688b

Please sign in to comment.