File tree Expand file tree Collapse file tree 6 files changed +69
-47
lines changed Expand file tree Collapse file tree 6 files changed +69
-47
lines changed Original file line number Diff line number Diff line change 1
- import fullstack , {
2
- reactHmrPreamblePlugin ,
3
- } from "@hiogawa/vite-plugin-fullstack" ;
1
+ import fullstack from "@hiogawa/vite-plugin-fullstack" ;
4
2
// import inspect from "vite-plugin-inspect";
5
3
import react from "@vitejs/plugin-react" ;
6
- import { defineConfig } from "vite" ;
4
+ import { type Plugin , defineConfig } from "vite" ;
7
5
8
6
export default defineConfig ( ( _env ) => ( {
9
7
clearScreen : false ,
@@ -42,3 +40,18 @@ export default defineConfig((_env) => ({
42
40
} ,
43
41
} ,
44
42
} ) ) ;
43
+
44
+ // waiting for https://github.com/vitejs/vite-plugin-react/pull/890
45
+ function reactHmrPreamblePlugin ( ) : Plugin [ ] {
46
+ return [
47
+ {
48
+ name : "react-hmr-preamble" ,
49
+ resolveId : ( id ) =>
50
+ id === "virtual:react-hmr-preamble" ? "\0" + id : null ,
51
+ load : ( id ) =>
52
+ id === "\0virtual:react-hmr-preamble"
53
+ ? react . preambleCode . replace ( "__BASE__" , "/" )
54
+ : null ,
55
+ } ,
56
+ ] ;
57
+ }
Original file line number Diff line number Diff line change 1
1
import { cloudflare } from "@cloudflare/vite-plugin" ;
2
- import fullstack , {
3
- reactHmrPreamblePlugin ,
4
- } from "@hiogawa/vite-plugin-fullstack" ;
2
+ import fullstack from "@hiogawa/vite-plugin-fullstack" ;
5
3
import react from "@vitejs/plugin-react" ;
6
- import { defineConfig } from "vite" ;
4
+ import { type Plugin , defineConfig } from "vite" ;
7
5
8
6
export default defineConfig ( ( _env ) => ( {
9
7
clearScreen : false ,
@@ -47,3 +45,18 @@ export default defineConfig((_env) => ({
47
45
} ,
48
46
} ,
49
47
} ) ) ;
48
+
49
+ // waiting for https://github.com/vitejs/vite-plugin-react/pull/890
50
+ function reactHmrPreamblePlugin ( ) : Plugin [ ] {
51
+ return [
52
+ {
53
+ name : "react-hmr-preamble" ,
54
+ resolveId : ( id ) =>
55
+ id === "virtual:react-hmr-preamble" ? "\0" + id : null ,
56
+ load : ( id ) =>
57
+ id === "\0virtual:react-hmr-preamble"
58
+ ? react . preambleCode . replace ( "__BASE__" , "/" )
59
+ : null ,
60
+ } ,
61
+ ] ;
62
+ }
Original file line number Diff line number Diff line change 1
- import fullstack , {
2
- reactHmrPreamblePlugin ,
3
- } from "@hiogawa/vite-plugin-fullstack" ;
1
+ import fullstack from "@hiogawa/vite-plugin-fullstack" ;
4
2
import react from "@vitejs/plugin-react" ;
5
- import { defineConfig } from "vite" ;
3
+ import { type Plugin , defineConfig } from "vite" ;
6
4
7
5
export default defineConfig ( ( _env ) => ( {
8
6
clearScreen : false ,
@@ -40,3 +38,18 @@ export default defineConfig((_env) => ({
40
38
} ,
41
39
} ,
42
40
} ) ) ;
41
+
42
+ // waiting for https://github.com/vitejs/vite-plugin-react/pull/890
43
+ function reactHmrPreamblePlugin ( ) : Plugin [ ] {
44
+ return [
45
+ {
46
+ name : "react-hmr-preamble" ,
47
+ resolveId : ( id ) =>
48
+ id === "virtual:react-hmr-preamble" ? "\0" + id : null ,
49
+ load : ( id ) =>
50
+ id === "\0virtual:react-hmr-preamble"
51
+ ? react . preambleCode . replace ( "__BASE__" , "/" )
52
+ : null ,
53
+ } ,
54
+ ] ;
55
+ }
Original file line number Diff line number Diff line change 1
- import fullstack , {
2
- reactHmrPreamblePlugin ,
3
- } from "@hiogawa/vite-plugin-fullstack" ;
1
+ import fullstack from "@hiogawa/vite-plugin-fullstack" ;
4
2
// import inspect from "vite-plugin-inspect";
5
3
import react from "@vitejs/plugin-react" ;
6
- import { defineConfig } from "vite" ;
4
+ import { type Plugin , defineConfig } from "vite" ;
7
5
import devtoolsJson from "vite-plugin-devtools-json" ;
8
6
9
7
export default defineConfig ( ( _env ) => ( {
@@ -44,3 +42,18 @@ export default defineConfig((_env) => ({
44
42
} ,
45
43
} ,
46
44
} ) ) ;
45
+
46
+ // waiting for https://github.com/vitejs/vite-plugin-react/pull/890
47
+ function reactHmrPreamblePlugin ( ) : Plugin [ ] {
48
+ return [
49
+ {
50
+ name : "react-hmr-preamble" ,
51
+ resolveId : ( id ) =>
52
+ id === "virtual:react-hmr-preamble" ? "\0" + id : null ,
53
+ load : ( id ) =>
54
+ id === "\0virtual:react-hmr-preamble"
55
+ ? react . preambleCode . replace ( "__BASE__" , "/" )
56
+ : null ,
57
+ } ,
58
+ ] ;
59
+ }
Original file line number Diff line number Diff line change 1
- export { default , assetsPlugin } from "./plugin.ts" ;
2
- export { reactHmrPreamblePlugin } from "./plugins/react.ts" ;
1
+ export { default , serverHandlerPlugin , assetsPlugin } from "./plugin.ts" ;
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments