ssr-plugin-react 6.2.25 → 6.2.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +243 -0
- package/cjs/config/client.d.ts +1 -0
- package/cjs/config/client.d.ts.map +1 -1
- package/cjs/config/client.js +5 -18
- package/cjs/entry/server-entry.js +2 -2
- package/cjs/index.d.ts.map +1 -1
- package/cjs/index.js +9 -1
- package/cjs/tools/vite.d.ts +3 -1
- package/cjs/tools/vite.d.ts.map +1 -1
- package/cjs/tools/vite.js +31 -8
- package/esm/config/client.d.ts +1 -0
- package/esm/config/client.d.ts.map +1 -1
- package/esm/config/client.js +6 -19
- package/esm/entry/server-entry.js +2 -2
- package/esm/index.d.ts.map +1 -1
- package/esm/index.js +10 -2
- package/esm/tools/vite.d.ts +3 -1
- package/esm/tools/vite.d.ts.map +1 -1
- package/esm/tools/vite.js +29 -8
- package/package.json +5 -4
- package/src/config/client.ts +6 -19
- package/src/entry/server-entry.tsx +2 -2
- package/src/index.ts +11 -2
- package/src/tools/vite.ts +27 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,246 @@
|
|
|
1
|
+
## [6.2.28](https://github.com/zhangyuang/ssr/compare/v6.2.8...v6.2.28) (2022-07-11)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* add build:publish disable sourcemap ([ef82b29](https://github.com/zhangyuang/ssr/commit/ef82b298ddf19b72b130d76c33bfbca67339b139))
|
|
7
|
+
* add prefix output to window.prefix in csr mode ([#197](https://github.com/zhangyuang/ssr/issues/197)) ([479bb3d](https://github.com/zhangyuang/ssr/commit/479bb3df67d7da5635939a4219b5f5f9a40b5508))
|
|
8
|
+
* build html ([83be7be](https://github.com/zhangyuang/ssr/commit/83be7be185985a5dcbb9b8e846a5e2b14b94c1b0))
|
|
9
|
+
* build html ([59a8d7f](https://github.com/zhangyuang/ssr/commit/59a8d7f31bed703601e753d02db49ea5a0f93054))
|
|
10
|
+
* ci ([57e713f](https://github.com/zhangyuang/ssr/commit/57e713f1f96b4ceb893837c15c6032b23a0b1a4c))
|
|
11
|
+
* core-js types ([036bf38](https://github.com/zhangyuang/ssr/commit/036bf385d8ed804dfc2e46ef4484f7bf499d7cdb))
|
|
12
|
+
* don't throw error when load module failed ([2e5d077](https://github.com/zhangyuang/ssr/commit/2e5d077848dc10998a04fcccccc7c745c0d1bea7))
|
|
13
|
+
* fetch data after use pinia ([3d1a3f4](https://github.com/zhangyuang/ssr/commit/3d1a3f41d6f5c001c4e233aba25608147fdae2a2))
|
|
14
|
+
* fix config htmlTemplate read ([#191](https://github.com/zhangyuang/ssr/issues/191)) ([8c3e12b](https://github.com/zhangyuang/ssr/commit/8c3e12b6adb64b7898bc6232d980e72c5353026b))
|
|
15
|
+
* loadConfig ([8960c84](https://github.com/zhangyuang/ssr/commit/8960c84eea7b384d59ebfe6424813afec433b3f8))
|
|
16
|
+
* lock babel-plugin-import ([72c3041](https://github.com/zhangyuang/ssr/commit/72c3041bf61a1fc9b7593df1fdb6c4dc850c6bbd))
|
|
17
|
+
* lock vite version in plugin-react ([e015b75](https://github.com/zhangyuang/ssr/commit/e015b750c60dcae9a4a7e5fe14937177b80367ca))
|
|
18
|
+
* plugin-react without dynamic mode ([487cc84](https://github.com/zhangyuang/ssr/commit/487cc84188640aab13c27214df758da0d19e4368))
|
|
19
|
+
* postinstall ([fef24ba](https://github.com/zhangyuang/ssr/commit/fef24bada3498f162efd0bdd09921503e44ad21a))
|
|
20
|
+
* postinstall get correct path ([b3d1951](https://github.com/zhangyuang/ssr/commit/b3d1951b7537c5954fd040797fc0011a1d4439d7))
|
|
21
|
+
* react router basename in server entry ([#212](https://github.com/zhangyuang/ssr/issues/212)) ([28072f7](https://github.com/zhangyuang/ssr/commit/28072f7bdfc489a27599b636db33bdea18ef4c18))
|
|
22
|
+
* Recommended to specify used minor core-js version ([#207](https://github.com/zhangyuang/ssr/issues/207)) ([9db0424](https://github.com/zhangyuang/ssr/commit/9db0424e5e7ad1728d40665d01740f7a2c1c4b70))
|
|
23
|
+
* release utils ([1b9c56b](https://github.com/zhangyuang/ssr/commit/1b9c56bc904faa0cae39fb329c02b5d159d69872))
|
|
24
|
+
* restore webpack split chunks config ([2f7ae67](https://github.com/zhangyuang/ssr/commit/2f7ae67ecef863d56752a4a4e1fa7a75ec0756ed))
|
|
25
|
+
* revert vite build ([210ddea](https://github.com/zhangyuang/ssr/commit/210ddea22fc0639f60fcee96bdf47463d188e18f))
|
|
26
|
+
* update preinstall ([2b4b869](https://github.com/zhangyuang/ssr/commit/2b4b869c28b83b414bef10260e5561bc3773cea9))
|
|
27
|
+
* useStore types ([3532bfb](https://github.com/zhangyuang/ssr/commit/3532bfbef9981da300abf748a98925b59cc2c71d))
|
|
28
|
+
* vite build logic close [#221](https://github.com/zhangyuang/ssr/issues/221) ([297e2c0](https://github.com/zhangyuang/ssr/commit/297e2c0e5ad6609ce8cd3954a5886387f84343e6))
|
|
29
|
+
* vite mode config.base ([c64aa1a](https://github.com/zhangyuang/ssr/commit/c64aa1ab9d88cdfd7df1cce6feb43b191847e666))
|
|
30
|
+
* **vite:** vite config base use publicPath first in client ([#192](https://github.com/zhangyuang/ssr/issues/192)) ([ef5b145](https://github.com/zhangyuang/ssr/commit/ef5b1451850441b0748727d09144e6e671f71208))
|
|
31
|
+
* vue3 package.json ([c49fb14](https://github.com/zhangyuang/ssr/commit/c49fb146fc6ba79ffbeee567e334b560ffecbcac))
|
|
32
|
+
* whitList concat userconfig ([fdd971a](https://github.com/zhangyuang/ssr/commit/fdd971ab11aebc0f348d789e758183b877e791af))
|
|
33
|
+
* whitList concat userconfig ([e2328f8](https://github.com/zhangyuang/ssr/commit/e2328f87f5cfc18c9a30867e4f6e18d0df5c1ba3))
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
### Features
|
|
37
|
+
|
|
38
|
+
* optimize code remove disableClientRender fix vite ([eeff477](https://github.com/zhangyuang/ssr/commit/eeff4770f8d9ff400289cf4d1ca4dd32883be108))
|
|
39
|
+
* add .vue to defaultWhiteList ([dbabfa2](https://github.com/zhangyuang/ssr/commit/dbabfa2864ec0a5487aadc31286da5630a8603fc))
|
|
40
|
+
* add `turbo` ([#196](https://github.com/zhangyuang/ssr/issues/196)) ([2be17bb](https://github.com/zhangyuang/ssr/commit/2be17bba5d80610b97b3813b3d4fe9579f88e5c3))
|
|
41
|
+
* add parseRoutes watcher when files changed remove webpack-chain in ([a499654](https://github.com/zhangyuang/ssr/commit/a49965470e2b1e1d9744b59baede586bdd5fff90))
|
|
42
|
+
* add ssr-common-utils ([c12a283](https://github.com/zhangyuang/ssr/commit/c12a283e0133285402f4af5cd0346b84f2aaf098))
|
|
43
|
+
* add ssr-serialize-javascript code optimize ([41bb14d](https://github.com/zhangyuang/ssr/commit/41bb14d31efd89d4a85d5220544d2f7a3883e1a3))
|
|
44
|
+
* add useStore ([b786b8c](https://github.com/zhangyuang/ssr/commit/b786b8cc314ce9d45d56ac68c93020209643b208))
|
|
45
|
+
* add viteConfig.ssr.external ([2035967](https://github.com/zhangyuang/ssr/commit/2035967def8d2f9d48997d6994efd8ffbb4fd382))
|
|
46
|
+
* babelExtraModule support vue ([06251e7](https://github.com/zhangyuang/ssr/commit/06251e716678e1f882f06f68f72c518a341de0d7))
|
|
47
|
+
* babelExtraModule support vue ([513073d](https://github.com/zhangyuang/ssr/commit/513073ddcecbb728d34eae233686a93d63355e00))
|
|
48
|
+
* change splitChunks from all to initial ([f0de225](https://github.com/zhangyuang/ssr/commit/f0de22566ff7769b02d3b7d7b75bde12a5b2c28a))
|
|
49
|
+
* don't cover viteConfig.build ([02aef3b](https://github.com/zhangyuang/ssr/commit/02aef3b44c1cde54d8586f0d73defdcdc7ce0ad3))
|
|
50
|
+
* generate html file support inject prefix ([02741ee](https://github.com/zhangyuang/ssr/commit/02741eeda778eec26504c5e7e2c074b1d2402e83))
|
|
51
|
+
* move react-router to external ([0a58570](https://github.com/zhangyuang/ssr/commit/0a585705fb66d9f3a4a59008f1f3e82b23f05fae))
|
|
52
|
+
* optimize customescript ([f374760](https://github.com/zhangyuang/ssr/commit/f3747608d4684576875968394eca6315e2fa8dd1))
|
|
53
|
+
* plugin-midway remove luckyeye ([bb4b11f](https://github.com/zhangyuang/ssr/commit/bb4b11f289d060c8b332cf610bb6d8c4cf25142b))
|
|
54
|
+
* plugin-react add react-refresh, remove module.hot ([7bee211](https://github.com/zhangyuang/ssr/commit/7bee211ddfefaef688713f505756e1155320b844))
|
|
55
|
+
* remove plugin-nestjs deploy ([0ba16f8](https://github.com/zhangyuang/ssr/commit/0ba16f861b6dc679f216cbbcc931de75cdf79501))
|
|
56
|
+
* render add generic function overloading ([f03897f](https://github.com/zhangyuang/ssr/commit/f03897f07844d8fd5f9d2cf3eeef1a726da794bf))
|
|
57
|
+
* set argv.ssl for plugin-midway ([#213](https://github.com/zhangyuang/ssr/issues/213)) ([65c1cb9](https://github.com/zhangyuang/ssr/commit/65c1cb9da0772e915162dcd9b03fad2fada22b40))
|
|
58
|
+
* support htmlTemplate ([b240811](https://github.com/zhangyuang/ssr/commit/b2408114a6314ef4f96f4c06159d18fc6d881a57))
|
|
59
|
+
* support more vite config ([3ac5edc](https://github.com/zhangyuang/ssr/commit/3ac5edc605b59a1e1927fad0838cc730aba82b59))
|
|
60
|
+
* support props.ssrApp in vue3 ([8985037](https://github.com/zhangyuang/ssr/commit/898503753cbe69187d27f91c70dff3f4cd4a0b2a))
|
|
61
|
+
* support vite + wasm vite otherConfig ([7e65899](https://github.com/zhangyuang/ssr/commit/7e658998bc404c28374645c3a8a433a3db171f36))
|
|
62
|
+
* support vuex store options ([9bed529](https://github.com/zhangyuang/ssr/commit/9bed5299a59386e0cd70abbb8a66eca6090ed400))
|
|
63
|
+
* support wasm in webpack, lock postcss-preset-env version ([8ad50a4](https://github.com/zhangyuang/ssr/commit/8ad50a41227a8eb5395c955e5deeda7eb56036b0))
|
|
64
|
+
* support wildcare params ([c5cde18](https://github.com/zhangyuang/ssr/commit/c5cde18566365f9d3bbc81691c0ca5e7b72607d4))
|
|
65
|
+
* update chainBaseConfig ([51c1fbe](https://github.com/zhangyuang/ssr/commit/51c1fbe5a645d4701c7ebc035083096d50301891))
|
|
66
|
+
* update extraJsOrder extraCssOrder ([cd5ca99](https://github.com/zhangyuang/ssr/commit/cd5ca99a686ea565020500a6c4f77e310b422ce3))
|
|
67
|
+
* update fetch params ([70aedaa](https://github.com/zhangyuang/ssr/commit/70aedaa82a69552e22af1998bf1c2de8e30e0283))
|
|
68
|
+
* update midway deploy ([a473c59](https://github.com/zhangyuang/ssr/commit/a473c599657df42b4bf7a59f248b3c7c33907657))
|
|
69
|
+
* update plugin-vue3 support call pinia in fetch.ts ([958fdc7](https://github.com/zhangyuang/ssr/commit/958fdc787ab615593f3114a6bf2c6cea4823afc2))
|
|
70
|
+
* update ssr-common-utils ([c7cadc1](https://github.com/zhangyuang/ssr/commit/c7cadc14922383f8fdaa6c76b4dbe9c220d0ac72))
|
|
71
|
+
* update turbo ([9ee14f5](https://github.com/zhangyuang/ssr/commit/9ee14f59359187e35f4ef990998846ac3847347b))
|
|
72
|
+
* update vite config ([0596573](https://github.com/zhangyuang/ssr/commit/05965738898d96d53dedbd41746b8100dcc5653b))
|
|
73
|
+
* update vue example inject content for consistent ([c863c01](https://github.com/zhangyuang/ssr/commit/c863c011fc06ceed5d204d3d96eea29cf7c7d4b8))
|
|
74
|
+
* upgrade midway example to v3 ([572f7c5](https://github.com/zhangyuang/ssr/commit/572f7c5d171346cc17f5f6cdebe33aee76e0c146))
|
|
75
|
+
* upgrade vite@2.9.13 move ssr-hoc-react to noOptimize close [#216](https://github.com/zhangyuang/ssr/issues/216) ([842b8af](https://github.com/zhangyuang/ssr/commit/842b8af830927731a2fb35d77dde7c2a051c3670))
|
|
76
|
+
* upgrade vue-router^2 to vue-router^3 ([283ed9e](https://github.com/zhangyuang/ssr/commit/283ed9ec4f6d8a622bcc3599ca33f9b0885ed3e5))
|
|
77
|
+
* use pnpm replace yarn workspace and lerna ([#186](https://github.com/zhangyuang/ssr/issues/186)) ([d578506](https://github.com/zhangyuang/ssr/commit/d578506160712847c1dd021b7759c7e9ff3c03e8))
|
|
78
|
+
* use ssr-vite-plugin-style-import ([1c8cac2](https://github.com/zhangyuang/ssr/commit/1c8cac2ff9bb7ec0132c23203efa5c85a8c7492e))
|
|
79
|
+
* use terser minify plugin-react server bundle ([0a3c7fe](https://github.com/zhangyuang/ssr/commit/0a3c7fe61908fe24bcb2d8c6394daf2afd18ba82))
|
|
80
|
+
* vite build extra vendor ([#210](https://github.com/zhangyuang/ssr/issues/210)) ([3eb6e4f](https://github.com/zhangyuang/ssr/commit/3eb6e4fde592a6ef59a7fd6790b56e38c187960d))
|
|
81
|
+
* vite build extra vendor and client-entry ([#211](https://github.com/zhangyuang/ssr/issues/211)) ([41fb1fe](https://github.com/zhangyuang/ssr/commit/41fb1fef04a1c954828d42e4dfe40445bcea444f))
|
|
82
|
+
* vite mode support splitChunk dynamic module ([4157fc2](https://github.com/zhangyuang/ssr/commit/4157fc24176b69c9815450b3623742995feae144))
|
|
83
|
+
* vue3 add default isCustomElement ([44ab37c](https://github.com/zhangyuang/ssr/commit/44ab37c27908b5927578d78a834d2404d42c70dd))
|
|
84
|
+
* vue3 support pinia, replace props.fetchData to props.reactiveFetchData in vue2/3 ([eabcb50](https://github.com/zhangyuang/ssr/commit/eabcb50729517b7cb649729d52356a06a010a8fc))
|
|
85
|
+
* webpack build optimize ([#222](https://github.com/zhangyuang/ssr/issues/222)) ([217dd38](https://github.com/zhangyuang/ssr/commit/217dd388c70d2a7d93d8eeec64a3d26136afe51b))
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
## [6.2.27](https://github.com/zhangyuang/ssr/compare/v6.2.8...v6.2.27) (2022-07-04)
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
### Bug Fixes
|
|
93
|
+
|
|
94
|
+
* add build:publish disable sourcemap ([ef82b29](https://github.com/zhangyuang/ssr/commit/ef82b298ddf19b72b130d76c33bfbca67339b139))
|
|
95
|
+
* add prefix output to window.prefix in csr mode ([#197](https://github.com/zhangyuang/ssr/issues/197)) ([479bb3d](https://github.com/zhangyuang/ssr/commit/479bb3df67d7da5635939a4219b5f5f9a40b5508))
|
|
96
|
+
* build html ([83be7be](https://github.com/zhangyuang/ssr/commit/83be7be185985a5dcbb9b8e846a5e2b14b94c1b0))
|
|
97
|
+
* build html ([59a8d7f](https://github.com/zhangyuang/ssr/commit/59a8d7f31bed703601e753d02db49ea5a0f93054))
|
|
98
|
+
* ci ([57e713f](https://github.com/zhangyuang/ssr/commit/57e713f1f96b4ceb893837c15c6032b23a0b1a4c))
|
|
99
|
+
* core-js types ([036bf38](https://github.com/zhangyuang/ssr/commit/036bf385d8ed804dfc2e46ef4484f7bf499d7cdb))
|
|
100
|
+
* don't throw error when load module failed ([2e5d077](https://github.com/zhangyuang/ssr/commit/2e5d077848dc10998a04fcccccc7c745c0d1bea7))
|
|
101
|
+
* fix config htmlTemplate read ([#191](https://github.com/zhangyuang/ssr/issues/191)) ([8c3e12b](https://github.com/zhangyuang/ssr/commit/8c3e12b6adb64b7898bc6232d980e72c5353026b))
|
|
102
|
+
* loadConfig ([8960c84](https://github.com/zhangyuang/ssr/commit/8960c84eea7b384d59ebfe6424813afec433b3f8))
|
|
103
|
+
* lock babel-plugin-import ([72c3041](https://github.com/zhangyuang/ssr/commit/72c3041bf61a1fc9b7593df1fdb6c4dc850c6bbd))
|
|
104
|
+
* lock vite version in plugin-react ([e015b75](https://github.com/zhangyuang/ssr/commit/e015b750c60dcae9a4a7e5fe14937177b80367ca))
|
|
105
|
+
* plugin-react without dynamic mode ([487cc84](https://github.com/zhangyuang/ssr/commit/487cc84188640aab13c27214df758da0d19e4368))
|
|
106
|
+
* postinstall ([fef24ba](https://github.com/zhangyuang/ssr/commit/fef24bada3498f162efd0bdd09921503e44ad21a))
|
|
107
|
+
* postinstall get correct path ([b3d1951](https://github.com/zhangyuang/ssr/commit/b3d1951b7537c5954fd040797fc0011a1d4439d7))
|
|
108
|
+
* react router basename in server entry ([#212](https://github.com/zhangyuang/ssr/issues/212)) ([28072f7](https://github.com/zhangyuang/ssr/commit/28072f7bdfc489a27599b636db33bdea18ef4c18))
|
|
109
|
+
* Recommended to specify used minor core-js version ([#207](https://github.com/zhangyuang/ssr/issues/207)) ([9db0424](https://github.com/zhangyuang/ssr/commit/9db0424e5e7ad1728d40665d01740f7a2c1c4b70))
|
|
110
|
+
* release utils ([1b9c56b](https://github.com/zhangyuang/ssr/commit/1b9c56bc904faa0cae39fb329c02b5d159d69872))
|
|
111
|
+
* restore webpack split chunks config ([2f7ae67](https://github.com/zhangyuang/ssr/commit/2f7ae67ecef863d56752a4a4e1fa7a75ec0756ed))
|
|
112
|
+
* revert vite build ([210ddea](https://github.com/zhangyuang/ssr/commit/210ddea22fc0639f60fcee96bdf47463d188e18f))
|
|
113
|
+
* update preinstall ([2b4b869](https://github.com/zhangyuang/ssr/commit/2b4b869c28b83b414bef10260e5561bc3773cea9))
|
|
114
|
+
* useStore types ([3532bfb](https://github.com/zhangyuang/ssr/commit/3532bfbef9981da300abf748a98925b59cc2c71d))
|
|
115
|
+
* vite mode config.base ([c64aa1a](https://github.com/zhangyuang/ssr/commit/c64aa1ab9d88cdfd7df1cce6feb43b191847e666))
|
|
116
|
+
* **vite:** vite config base use publicPath first in client ([#192](https://github.com/zhangyuang/ssr/issues/192)) ([ef5b145](https://github.com/zhangyuang/ssr/commit/ef5b1451850441b0748727d09144e6e671f71208))
|
|
117
|
+
* vue3 package.json ([c49fb14](https://github.com/zhangyuang/ssr/commit/c49fb146fc6ba79ffbeee567e334b560ffecbcac))
|
|
118
|
+
* whitList concat userconfig ([fdd971a](https://github.com/zhangyuang/ssr/commit/fdd971ab11aebc0f348d789e758183b877e791af))
|
|
119
|
+
* whitList concat userconfig ([e2328f8](https://github.com/zhangyuang/ssr/commit/e2328f87f5cfc18c9a30867e4f6e18d0df5c1ba3))
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
### Features
|
|
123
|
+
|
|
124
|
+
* optimize code remove disableClientRender fix vite ([eeff477](https://github.com/zhangyuang/ssr/commit/eeff4770f8d9ff400289cf4d1ca4dd32883be108))
|
|
125
|
+
* add .vue to defaultWhiteList ([dbabfa2](https://github.com/zhangyuang/ssr/commit/dbabfa2864ec0a5487aadc31286da5630a8603fc))
|
|
126
|
+
* add `turbo` ([#196](https://github.com/zhangyuang/ssr/issues/196)) ([2be17bb](https://github.com/zhangyuang/ssr/commit/2be17bba5d80610b97b3813b3d4fe9579f88e5c3))
|
|
127
|
+
* add parseRoutes watcher when files changed remove webpack-chain in ([a499654](https://github.com/zhangyuang/ssr/commit/a49965470e2b1e1d9744b59baede586bdd5fff90))
|
|
128
|
+
* add ssr-common-utils ([c12a283](https://github.com/zhangyuang/ssr/commit/c12a283e0133285402f4af5cd0346b84f2aaf098))
|
|
129
|
+
* add ssr-serialize-javascript code optimize ([41bb14d](https://github.com/zhangyuang/ssr/commit/41bb14d31efd89d4a85d5220544d2f7a3883e1a3))
|
|
130
|
+
* add useStore ([b786b8c](https://github.com/zhangyuang/ssr/commit/b786b8cc314ce9d45d56ac68c93020209643b208))
|
|
131
|
+
* add viteConfig.ssr.external ([2035967](https://github.com/zhangyuang/ssr/commit/2035967def8d2f9d48997d6994efd8ffbb4fd382))
|
|
132
|
+
* babelExtraModule support vue ([06251e7](https://github.com/zhangyuang/ssr/commit/06251e716678e1f882f06f68f72c518a341de0d7))
|
|
133
|
+
* babelExtraModule support vue ([513073d](https://github.com/zhangyuang/ssr/commit/513073ddcecbb728d34eae233686a93d63355e00))
|
|
134
|
+
* change splitChunks from all to initial ([f0de225](https://github.com/zhangyuang/ssr/commit/f0de22566ff7769b02d3b7d7b75bde12a5b2c28a))
|
|
135
|
+
* don't cover viteConfig.build ([02aef3b](https://github.com/zhangyuang/ssr/commit/02aef3b44c1cde54d8586f0d73defdcdc7ce0ad3))
|
|
136
|
+
* generate html file support inject prefix ([02741ee](https://github.com/zhangyuang/ssr/commit/02741eeda778eec26504c5e7e2c074b1d2402e83))
|
|
137
|
+
* move react-router to external ([0a58570](https://github.com/zhangyuang/ssr/commit/0a585705fb66d9f3a4a59008f1f3e82b23f05fae))
|
|
138
|
+
* optimize customescript ([f374760](https://github.com/zhangyuang/ssr/commit/f3747608d4684576875968394eca6315e2fa8dd1))
|
|
139
|
+
* plugin-midway remove luckyeye ([bb4b11f](https://github.com/zhangyuang/ssr/commit/bb4b11f289d060c8b332cf610bb6d8c4cf25142b))
|
|
140
|
+
* plugin-react add react-refresh, remove module.hot ([7bee211](https://github.com/zhangyuang/ssr/commit/7bee211ddfefaef688713f505756e1155320b844))
|
|
141
|
+
* remove plugin-nestjs deploy ([0ba16f8](https://github.com/zhangyuang/ssr/commit/0ba16f861b6dc679f216cbbcc931de75cdf79501))
|
|
142
|
+
* render add generic function overloading ([f03897f](https://github.com/zhangyuang/ssr/commit/f03897f07844d8fd5f9d2cf3eeef1a726da794bf))
|
|
143
|
+
* set argv.ssl for plugin-midway ([#213](https://github.com/zhangyuang/ssr/issues/213)) ([65c1cb9](https://github.com/zhangyuang/ssr/commit/65c1cb9da0772e915162dcd9b03fad2fada22b40))
|
|
144
|
+
* support htmlTemplate ([b240811](https://github.com/zhangyuang/ssr/commit/b2408114a6314ef4f96f4c06159d18fc6d881a57))
|
|
145
|
+
* support props.ssrApp in vue3 ([8985037](https://github.com/zhangyuang/ssr/commit/898503753cbe69187d27f91c70dff3f4cd4a0b2a))
|
|
146
|
+
* support vite + wasm vite otherConfig ([7e65899](https://github.com/zhangyuang/ssr/commit/7e658998bc404c28374645c3a8a433a3db171f36))
|
|
147
|
+
* support vuex store options ([9bed529](https://github.com/zhangyuang/ssr/commit/9bed5299a59386e0cd70abbb8a66eca6090ed400))
|
|
148
|
+
* support wasm in webpack, lock postcss-preset-env version ([8ad50a4](https://github.com/zhangyuang/ssr/commit/8ad50a41227a8eb5395c955e5deeda7eb56036b0))
|
|
149
|
+
* support wildcare params ([c5cde18](https://github.com/zhangyuang/ssr/commit/c5cde18566365f9d3bbc81691c0ca5e7b72607d4))
|
|
150
|
+
* update chainBaseConfig ([51c1fbe](https://github.com/zhangyuang/ssr/commit/51c1fbe5a645d4701c7ebc035083096d50301891))
|
|
151
|
+
* update extraJsOrder extraCssOrder ([cd5ca99](https://github.com/zhangyuang/ssr/commit/cd5ca99a686ea565020500a6c4f77e310b422ce3))
|
|
152
|
+
* update fetch params ([70aedaa](https://github.com/zhangyuang/ssr/commit/70aedaa82a69552e22af1998bf1c2de8e30e0283))
|
|
153
|
+
* update midway deploy ([a473c59](https://github.com/zhangyuang/ssr/commit/a473c599657df42b4bf7a59f248b3c7c33907657))
|
|
154
|
+
* update plugin-vue3 support call pinia in fetch.ts ([958fdc7](https://github.com/zhangyuang/ssr/commit/958fdc787ab615593f3114a6bf2c6cea4823afc2))
|
|
155
|
+
* update ssr-common-utils ([c7cadc1](https://github.com/zhangyuang/ssr/commit/c7cadc14922383f8fdaa6c76b4dbe9c220d0ac72))
|
|
156
|
+
* update turbo ([9ee14f5](https://github.com/zhangyuang/ssr/commit/9ee14f59359187e35f4ef990998846ac3847347b))
|
|
157
|
+
* update vite config ([0596573](https://github.com/zhangyuang/ssr/commit/05965738898d96d53dedbd41746b8100dcc5653b))
|
|
158
|
+
* upgrade midway example to v3 ([572f7c5](https://github.com/zhangyuang/ssr/commit/572f7c5d171346cc17f5f6cdebe33aee76e0c146))
|
|
159
|
+
* upgrade vite@2.9.13 move ssr-hoc-react to noOptimize close [#216](https://github.com/zhangyuang/ssr/issues/216) ([842b8af](https://github.com/zhangyuang/ssr/commit/842b8af830927731a2fb35d77dde7c2a051c3670))
|
|
160
|
+
* upgrade vue-router^2 to vue-router^3 ([283ed9e](https://github.com/zhangyuang/ssr/commit/283ed9ec4f6d8a622bcc3599ca33f9b0885ed3e5))
|
|
161
|
+
* use pnpm replace yarn workspace and lerna ([#186](https://github.com/zhangyuang/ssr/issues/186)) ([d578506](https://github.com/zhangyuang/ssr/commit/d578506160712847c1dd021b7759c7e9ff3c03e8))
|
|
162
|
+
* use ssr-vite-plugin-style-import ([1c8cac2](https://github.com/zhangyuang/ssr/commit/1c8cac2ff9bb7ec0132c23203efa5c85a8c7492e))
|
|
163
|
+
* use terser minify plugin-react server bundle ([0a3c7fe](https://github.com/zhangyuang/ssr/commit/0a3c7fe61908fe24bcb2d8c6394daf2afd18ba82))
|
|
164
|
+
* vite build extra vendor ([#210](https://github.com/zhangyuang/ssr/issues/210)) ([3eb6e4f](https://github.com/zhangyuang/ssr/commit/3eb6e4fde592a6ef59a7fd6790b56e38c187960d))
|
|
165
|
+
* vite build extra vendor and client-entry ([#211](https://github.com/zhangyuang/ssr/issues/211)) ([41fb1fe](https://github.com/zhangyuang/ssr/commit/41fb1fef04a1c954828d42e4dfe40445bcea444f))
|
|
166
|
+
* vite mode support splitChunk dynamic module ([4157fc2](https://github.com/zhangyuang/ssr/commit/4157fc24176b69c9815450b3623742995feae144))
|
|
167
|
+
* vue3 add default isCustomElement ([44ab37c](https://github.com/zhangyuang/ssr/commit/44ab37c27908b5927578d78a834d2404d42c70dd))
|
|
168
|
+
* vue3 support pinia, replace props.fetchData to props.reactiveFetchData in vue2/3 ([eabcb50](https://github.com/zhangyuang/ssr/commit/eabcb50729517b7cb649729d52356a06a010a8fc))
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
## [6.2.26](https://github.com/zhangyuang/ssr/compare/v6.2.8...v6.2.26) (2022-06-22)
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
### Bug Fixes
|
|
176
|
+
|
|
177
|
+
* add build:publish disable sourcemap ([ef82b29](https://github.com/zhangyuang/ssr/commit/ef82b298ddf19b72b130d76c33bfbca67339b139))
|
|
178
|
+
* add prefix output to window.prefix in csr mode ([#197](https://github.com/zhangyuang/ssr/issues/197)) ([479bb3d](https://github.com/zhangyuang/ssr/commit/479bb3df67d7da5635939a4219b5f5f9a40b5508))
|
|
179
|
+
* build html ([83be7be](https://github.com/zhangyuang/ssr/commit/83be7be185985a5dcbb9b8e846a5e2b14b94c1b0))
|
|
180
|
+
* build html ([59a8d7f](https://github.com/zhangyuang/ssr/commit/59a8d7f31bed703601e753d02db49ea5a0f93054))
|
|
181
|
+
* ci ([57e713f](https://github.com/zhangyuang/ssr/commit/57e713f1f96b4ceb893837c15c6032b23a0b1a4c))
|
|
182
|
+
* core-js types ([036bf38](https://github.com/zhangyuang/ssr/commit/036bf385d8ed804dfc2e46ef4484f7bf499d7cdb))
|
|
183
|
+
* don't throw error when load module failed ([2e5d077](https://github.com/zhangyuang/ssr/commit/2e5d077848dc10998a04fcccccc7c745c0d1bea7))
|
|
184
|
+
* fix config htmlTemplate read ([#191](https://github.com/zhangyuang/ssr/issues/191)) ([8c3e12b](https://github.com/zhangyuang/ssr/commit/8c3e12b6adb64b7898bc6232d980e72c5353026b))
|
|
185
|
+
* loadConfig ([8960c84](https://github.com/zhangyuang/ssr/commit/8960c84eea7b384d59ebfe6424813afec433b3f8))
|
|
186
|
+
* lock babel-plugin-import ([72c3041](https://github.com/zhangyuang/ssr/commit/72c3041bf61a1fc9b7593df1fdb6c4dc850c6bbd))
|
|
187
|
+
* lock vite version in plugin-react ([e015b75](https://github.com/zhangyuang/ssr/commit/e015b750c60dcae9a4a7e5fe14937177b80367ca))
|
|
188
|
+
* plugin-react without dynamic mode ([487cc84](https://github.com/zhangyuang/ssr/commit/487cc84188640aab13c27214df758da0d19e4368))
|
|
189
|
+
* postinstall ([fef24ba](https://github.com/zhangyuang/ssr/commit/fef24bada3498f162efd0bdd09921503e44ad21a))
|
|
190
|
+
* postinstall get correct path ([b3d1951](https://github.com/zhangyuang/ssr/commit/b3d1951b7537c5954fd040797fc0011a1d4439d7))
|
|
191
|
+
* react router basename in server entry ([#212](https://github.com/zhangyuang/ssr/issues/212)) ([28072f7](https://github.com/zhangyuang/ssr/commit/28072f7bdfc489a27599b636db33bdea18ef4c18))
|
|
192
|
+
* Recommended to specify used minor core-js version ([#207](https://github.com/zhangyuang/ssr/issues/207)) ([9db0424](https://github.com/zhangyuang/ssr/commit/9db0424e5e7ad1728d40665d01740f7a2c1c4b70))
|
|
193
|
+
* restore webpack split chunks config ([2f7ae67](https://github.com/zhangyuang/ssr/commit/2f7ae67ecef863d56752a4a4e1fa7a75ec0756ed))
|
|
194
|
+
* revert vite build ([210ddea](https://github.com/zhangyuang/ssr/commit/210ddea22fc0639f60fcee96bdf47463d188e18f))
|
|
195
|
+
* update preinstall ([2b4b869](https://github.com/zhangyuang/ssr/commit/2b4b869c28b83b414bef10260e5561bc3773cea9))
|
|
196
|
+
* vite mode config.base ([c64aa1a](https://github.com/zhangyuang/ssr/commit/c64aa1ab9d88cdfd7df1cce6feb43b191847e666))
|
|
197
|
+
* **vite:** vite config base use publicPath first in client ([#192](https://github.com/zhangyuang/ssr/issues/192)) ([ef5b145](https://github.com/zhangyuang/ssr/commit/ef5b1451850441b0748727d09144e6e671f71208))
|
|
198
|
+
* vue3 package.json ([c49fb14](https://github.com/zhangyuang/ssr/commit/c49fb146fc6ba79ffbeee567e334b560ffecbcac))
|
|
199
|
+
* whitList concat userconfig ([fdd971a](https://github.com/zhangyuang/ssr/commit/fdd971ab11aebc0f348d789e758183b877e791af))
|
|
200
|
+
* whitList concat userconfig ([e2328f8](https://github.com/zhangyuang/ssr/commit/e2328f87f5cfc18c9a30867e4f6e18d0df5c1ba3))
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
### Features
|
|
204
|
+
|
|
205
|
+
* optimize code remove disableClientRender fix vite ([eeff477](https://github.com/zhangyuang/ssr/commit/eeff4770f8d9ff400289cf4d1ca4dd32883be108))
|
|
206
|
+
* add .vue to defaultWhiteList ([dbabfa2](https://github.com/zhangyuang/ssr/commit/dbabfa2864ec0a5487aadc31286da5630a8603fc))
|
|
207
|
+
* add `turbo` ([#196](https://github.com/zhangyuang/ssr/issues/196)) ([2be17bb](https://github.com/zhangyuang/ssr/commit/2be17bba5d80610b97b3813b3d4fe9579f88e5c3))
|
|
208
|
+
* add parseRoutes watcher when files changed remove webpack-chain in ([a499654](https://github.com/zhangyuang/ssr/commit/a49965470e2b1e1d9744b59baede586bdd5fff90))
|
|
209
|
+
* add ssr-common-utils ([c12a283](https://github.com/zhangyuang/ssr/commit/c12a283e0133285402f4af5cd0346b84f2aaf098))
|
|
210
|
+
* add ssr-serialize-javascript code optimize ([41bb14d](https://github.com/zhangyuang/ssr/commit/41bb14d31efd89d4a85d5220544d2f7a3883e1a3))
|
|
211
|
+
* add viteConfig.ssr.external ([2035967](https://github.com/zhangyuang/ssr/commit/2035967def8d2f9d48997d6994efd8ffbb4fd382))
|
|
212
|
+
* babelExtraModule support vue ([06251e7](https://github.com/zhangyuang/ssr/commit/06251e716678e1f882f06f68f72c518a341de0d7))
|
|
213
|
+
* babelExtraModule support vue ([513073d](https://github.com/zhangyuang/ssr/commit/513073ddcecbb728d34eae233686a93d63355e00))
|
|
214
|
+
* change splitChunks from all to initial ([f0de225](https://github.com/zhangyuang/ssr/commit/f0de22566ff7769b02d3b7d7b75bde12a5b2c28a))
|
|
215
|
+
* optimize customescript ([f374760](https://github.com/zhangyuang/ssr/commit/f3747608d4684576875968394eca6315e2fa8dd1))
|
|
216
|
+
* plugin-midway remove luckyeye ([bb4b11f](https://github.com/zhangyuang/ssr/commit/bb4b11f289d060c8b332cf610bb6d8c4cf25142b))
|
|
217
|
+
* plugin-react add react-refresh, remove module.hot ([7bee211](https://github.com/zhangyuang/ssr/commit/7bee211ddfefaef688713f505756e1155320b844))
|
|
218
|
+
* remove plugin-nestjs deploy ([0ba16f8](https://github.com/zhangyuang/ssr/commit/0ba16f861b6dc679f216cbbcc931de75cdf79501))
|
|
219
|
+
* render add generic function overloading ([f03897f](https://github.com/zhangyuang/ssr/commit/f03897f07844d8fd5f9d2cf3eeef1a726da794bf))
|
|
220
|
+
* support htmlTemplate ([b240811](https://github.com/zhangyuang/ssr/commit/b2408114a6314ef4f96f4c06159d18fc6d881a57))
|
|
221
|
+
* support props.ssrApp in vue3 ([8985037](https://github.com/zhangyuang/ssr/commit/898503753cbe69187d27f91c70dff3f4cd4a0b2a))
|
|
222
|
+
* support vite + wasm vite otherConfig ([7e65899](https://github.com/zhangyuang/ssr/commit/7e658998bc404c28374645c3a8a433a3db171f36))
|
|
223
|
+
* support wasm in webpack, lock postcss-preset-env version ([8ad50a4](https://github.com/zhangyuang/ssr/commit/8ad50a41227a8eb5395c955e5deeda7eb56036b0))
|
|
224
|
+
* update chainBaseConfig ([51c1fbe](https://github.com/zhangyuang/ssr/commit/51c1fbe5a645d4701c7ebc035083096d50301891))
|
|
225
|
+
* update extraJsOrder extraCssOrder ([cd5ca99](https://github.com/zhangyuang/ssr/commit/cd5ca99a686ea565020500a6c4f77e310b422ce3))
|
|
226
|
+
* update midway deploy ([a473c59](https://github.com/zhangyuang/ssr/commit/a473c599657df42b4bf7a59f248b3c7c33907657))
|
|
227
|
+
* update plugin-vue3 support call pinia in fetch.ts ([958fdc7](https://github.com/zhangyuang/ssr/commit/958fdc787ab615593f3114a6bf2c6cea4823afc2))
|
|
228
|
+
* update ssr-common-utils ([c7cadc1](https://github.com/zhangyuang/ssr/commit/c7cadc14922383f8fdaa6c76b4dbe9c220d0ac72))
|
|
229
|
+
* update turbo ([9ee14f5](https://github.com/zhangyuang/ssr/commit/9ee14f59359187e35f4ef990998846ac3847347b))
|
|
230
|
+
* update vite config ([0596573](https://github.com/zhangyuang/ssr/commit/05965738898d96d53dedbd41746b8100dcc5653b))
|
|
231
|
+
* upgrade midway example to v3 ([572f7c5](https://github.com/zhangyuang/ssr/commit/572f7c5d171346cc17f5f6cdebe33aee76e0c146))
|
|
232
|
+
* upgrade vue-router^2 to vue-router^3 ([283ed9e](https://github.com/zhangyuang/ssr/commit/283ed9ec4f6d8a622bcc3599ca33f9b0885ed3e5))
|
|
233
|
+
* use pnpm replace yarn workspace and lerna ([#186](https://github.com/zhangyuang/ssr/issues/186)) ([d578506](https://github.com/zhangyuang/ssr/commit/d578506160712847c1dd021b7759c7e9ff3c03e8))
|
|
234
|
+
* use ssr-vite-plugin-style-import ([1c8cac2](https://github.com/zhangyuang/ssr/commit/1c8cac2ff9bb7ec0132c23203efa5c85a8c7492e))
|
|
235
|
+
* use terser minify plugin-react server bundle ([0a3c7fe](https://github.com/zhangyuang/ssr/commit/0a3c7fe61908fe24bcb2d8c6394daf2afd18ba82))
|
|
236
|
+
* vite build extra vendor ([#210](https://github.com/zhangyuang/ssr/issues/210)) ([3eb6e4f](https://github.com/zhangyuang/ssr/commit/3eb6e4fde592a6ef59a7fd6790b56e38c187960d))
|
|
237
|
+
* vite build extra vendor and client-entry ([#211](https://github.com/zhangyuang/ssr/issues/211)) ([41fb1fe](https://github.com/zhangyuang/ssr/commit/41fb1fef04a1c954828d42e4dfe40445bcea444f))
|
|
238
|
+
* vite mode support splitChunk dynamic module ([4157fc2](https://github.com/zhangyuang/ssr/commit/4157fc24176b69c9815450b3623742995feae144))
|
|
239
|
+
* vue3 add default isCustomElement ([44ab37c](https://github.com/zhangyuang/ssr/commit/44ab37c27908b5927578d78a834d2404d42c70dd))
|
|
240
|
+
* vue3 support pinia, replace props.fetchData to props.reactiveFetchData in vue2/3 ([eabcb50](https://github.com/zhangyuang/ssr/commit/eabcb50729517b7cb649729d52356a06a010a8fc))
|
|
241
|
+
|
|
242
|
+
|
|
243
|
+
|
|
1
244
|
## [6.2.25](https://github.com/zhangyuang/ssr/compare/v6.2.8...v6.2.25) (2022-06-16)
|
|
2
245
|
|
|
3
246
|
|
package/cjs/config/client.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/config/client.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,YAAY,MAAM,eAAe,CAAA;AAW7C,QAAA,MAAM,gBAAgB,UAAW,YAAY,
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/config/client.ts"],"names":[],"mappings":";AAGA,OAAO,KAAK,YAAY,MAAM,eAAe,CAAA;AAW7C,QAAA,MAAM,gBAAgB,UAAW,YAAY,oCAiG5C,CAAA;AAED,OAAO,EACL,gBAAgB,EACjB,CAAA"}
|
package/cjs/config/client.js
CHANGED
|
@@ -13,7 +13,7 @@ const generateAnalysis = Boolean(process.env.GENERATE_ANALYSIS);
|
|
|
13
13
|
const loadModule = ssr_server_utils_1.loadModuleFromFramework;
|
|
14
14
|
let asyncChunkMap = {};
|
|
15
15
|
const getClientWebpack = (chain) => {
|
|
16
|
-
const { isDev, chunkName, getOutput, cwd, useHash, chainClientConfig, host, fePort } = (0, ssr_server_utils_1.loadConfig)();
|
|
16
|
+
const { isDev, chunkName, getOutput, cwd, useHash, chainClientConfig, host, fePort, optimize } = (0, ssr_server_utils_1.loadConfig)();
|
|
17
17
|
const shouldUseSourceMap = isDev || Boolean(process.env.GENERATE_SOURCEMAP);
|
|
18
18
|
const publicPath = (0, ssr_server_utils_1.getOutputPublicPath)();
|
|
19
19
|
(0, base_1.getBaseConfig)(chain, false);
|
|
@@ -29,22 +29,7 @@ const getClientWebpack = (chain) => {
|
|
|
29
29
|
.end();
|
|
30
30
|
chain.optimization
|
|
31
31
|
.runtimeChunk(true)
|
|
32
|
-
.splitChunks(
|
|
33
|
-
chunks: 'all',
|
|
34
|
-
name(module, chunks, cacheGroupKey) {
|
|
35
|
-
return (0, ssr_server_utils_1.cryptoAsyncChunkName)(chunks, asyncChunkMap);
|
|
36
|
-
},
|
|
37
|
-
cacheGroups: {
|
|
38
|
-
vendors: {
|
|
39
|
-
test: (module) => {
|
|
40
|
-
return module.resource &&
|
|
41
|
-
/\.js$/.test(module.resource) &&
|
|
42
|
-
module.resource.match('node_modules');
|
|
43
|
-
},
|
|
44
|
-
name: 'vendor'
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
})
|
|
32
|
+
.splitChunks((0, ssr_server_utils_1.getSplitChunksOptions)(asyncChunkMap))
|
|
48
33
|
.when(!isDev, optimization => {
|
|
49
34
|
optimization.minimizer('terser')
|
|
50
35
|
.use(loadModule('terser-webpack-plugin'), [{
|
|
@@ -105,7 +90,9 @@ const getClientWebpack = (chain) => {
|
|
|
105
90
|
asyncChunkMap = {};
|
|
106
91
|
});
|
|
107
92
|
compiler.hooks.done.tapAsync('WriteAsyncChunkManifest', async (params, callback) => {
|
|
108
|
-
|
|
93
|
+
if (!optimize) {
|
|
94
|
+
await fs_1.promises.writeFile((0, path_1.resolve)((0, ssr_server_utils_1.getCwd)(), './build/asyncChunkMap.json'), JSON.stringify(asyncChunkMap));
|
|
95
|
+
}
|
|
109
96
|
callback();
|
|
110
97
|
});
|
|
111
98
|
}
|
|
@@ -64,9 +64,9 @@ const serverRender = async (ctx, config) => {
|
|
|
64
64
|
}
|
|
65
65
|
const combineData = isCsr ? null : Object.assign(state !== null && state !== void 0 ? state : {}, layoutFetchData !== null && layoutFetchData !== void 0 ? layoutFetchData : {}, fetchData !== null && fetchData !== void 0 ? fetchData : {});
|
|
66
66
|
const injectState = isCsr ? React.createElement("script", { dangerouslySetInnerHTML: { __html: `window.prefix="${prefix}"` } }) : React.createElement("script", { dangerouslySetInnerHTML: {
|
|
67
|
-
__html: `window.__USE_SSR__=true; window.__INITIAL_DATA__ =${(0, ssr_serialize_javascript_1.serialize)(combineData)}; window.prefix="${prefix}";${clientPrefix
|
|
67
|
+
__html: `window.__USE_SSR__=true; window.__INITIAL_DATA__ =${(0, ssr_serialize_javascript_1.serialize)(combineData)}; window.prefix="${prefix}";${clientPrefix ? `window.clientPrefix="${clientPrefix}";` : ''}`
|
|
68
68
|
} });
|
|
69
|
-
return (React.createElement(react_router_dom_1.StaticRouter, { location: ctx.request.url },
|
|
69
|
+
return (React.createElement(react_router_dom_1.StaticRouter, { location: ctx.request.url, basename: prefix },
|
|
70
70
|
React.createElement(create_context_1.STORE_CONTEXT.Provider, { value: { state: combineData } },
|
|
71
71
|
React.createElement(Layout, { ctx: ctx, config: config, staticList: staticList, injectState: injectState },
|
|
72
72
|
React.createElement(Component, null)))));
|
package/cjs/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,wBAAgB,YAAY;;;;EA6B3B;AAED,cAAc,cAAc,CAAA"}
|
package/cjs/index.js
CHANGED
|
@@ -16,7 +16,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
exports.clientPlugin = void 0;
|
|
18
18
|
const ssr_server_utils_1 = require("ssr-server-utils");
|
|
19
|
-
const { isVite } = (0, ssr_server_utils_1.loadConfig)();
|
|
19
|
+
const { isVite, optimize } = (0, ssr_server_utils_1.loadConfig)();
|
|
20
|
+
const spinner = require('ora')('Building');
|
|
20
21
|
function clientPlugin() {
|
|
21
22
|
return {
|
|
22
23
|
name: 'plugin-react',
|
|
@@ -36,6 +37,13 @@ function clientPlugin() {
|
|
|
36
37
|
await viteBuild();
|
|
37
38
|
}
|
|
38
39
|
else {
|
|
40
|
+
if (optimize) {
|
|
41
|
+
spinner.start();
|
|
42
|
+
const { viteBuildClient } = await Promise.resolve().then(() => require('./tools/vite'));
|
|
43
|
+
await viteBuildClient();
|
|
44
|
+
(0, ssr_server_utils_1.cleanOutClientDir)();
|
|
45
|
+
spinner.stop();
|
|
46
|
+
}
|
|
39
47
|
const { webpackBuild } = await Promise.resolve().then(() => require('./tools/webpack'));
|
|
40
48
|
await webpackBuild();
|
|
41
49
|
}
|
package/cjs/tools/vite.d.ts
CHANGED
|
@@ -3,5 +3,7 @@ declare const serverConfig: UserConfig;
|
|
|
3
3
|
declare const clientConfig: UserConfig;
|
|
4
4
|
declare const viteStart: () => Promise<void>;
|
|
5
5
|
declare const viteBuild: () => Promise<void>;
|
|
6
|
-
|
|
6
|
+
declare const viteBuildClient: () => Promise<void>;
|
|
7
|
+
declare const viteBuildServer: () => Promise<void>;
|
|
8
|
+
export { viteBuild, viteStart, serverConfig, clientConfig, viteBuildClient, viteBuildServer };
|
|
7
9
|
//# sourceMappingURL=vite.d.ts.map
|
package/cjs/tools/vite.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vite.d.ts","sourceRoot":"","sources":["../../src/tools/vite.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,UAAU,EAAE,MAAM,MAAM,CAAA;AAgBxC,QAAA,MAAM,YAAY,EAAE,
|
|
1
|
+
{"version":3,"file":"vite.d.ts","sourceRoot":"","sources":["../../src/tools/vite.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,UAAU,EAAE,MAAM,MAAM,CAAA;AAgBxC,QAAA,MAAM,YAAY,EAAE,UA6CnB,CAAA;AACD,QAAA,MAAM,YAAY,EAAE,UAyCnB,CAAA;AACD,QAAA,MAAM,SAAS,qBAEd,CAAA;AACD,QAAA,MAAM,SAAS,qBAGd,CAAA;AAED,QAAA,MAAM,eAAe,qBAEpB,CAAA;AACD,QAAA,MAAM,eAAe,qBAEpB,CAAA;AAED,OAAO,EACL,SAAS,EACT,SAAS,EACT,YAAY,EACZ,YAAY,EACZ,eAAe,EACf,eAAe,EAChB,CAAA"}
|
package/cjs/tools/vite.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
2
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18;
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.clientConfig = exports.serverConfig = exports.viteStart = exports.viteBuild = void 0;
|
|
4
|
+
exports.viteBuildServer = exports.viteBuildClient = exports.clientConfig = exports.serverConfig = exports.viteStart = exports.viteBuild = void 0;
|
|
5
5
|
const vite_1 = require("vite");
|
|
6
6
|
const ssr_server_utils_1 = require("ssr-server-utils");
|
|
7
7
|
const plugin_react_1 = require("@vitejs/plugin-react");
|
|
@@ -41,12 +41,16 @@ const serverConfig = {
|
|
|
41
41
|
(0, ssr_vite_plugin_style_import_1.createStyleImportPlugin)(styleImportConfig)
|
|
42
42
|
],
|
|
43
43
|
esbuild: {
|
|
44
|
-
|
|
44
|
+
...(_k = (_j = viteConfig === null || viteConfig === void 0 ? void 0 : viteConfig().server) === null || _j === void 0 ? void 0 : _j.otherConfig) === null || _k === void 0 ? void 0 : _k.esbuild,
|
|
45
|
+
keepNames: true,
|
|
46
|
+
logOverride: { 'this-is-undefined-in-esm': 'silent' }
|
|
45
47
|
},
|
|
46
48
|
build: {
|
|
49
|
+
...(_m = (_l = viteConfig === null || viteConfig === void 0 ? void 0 : viteConfig().server) === null || _l === void 0 ? void 0 : _l.otherConfig) === null || _m === void 0 ? void 0 : _m.build,
|
|
47
50
|
ssr: reactServerEntry,
|
|
48
51
|
outDir: serverOutPut,
|
|
49
52
|
rollupOptions: {
|
|
53
|
+
...(_q = (_p = (_o = viteConfig === null || viteConfig === void 0 ? void 0 : viteConfig().server) === null || _o === void 0 ? void 0 : _o.otherConfig) === null || _p === void 0 ? void 0 : _p.build) === null || _q === void 0 ? void 0 : _q.rollupOptions,
|
|
50
54
|
input: isDev ? reactClientEntry : reactServerEntry,
|
|
51
55
|
output: {
|
|
52
56
|
entryFileNames: 'Page.server.js'
|
|
@@ -54,6 +58,7 @@ const serverConfig = {
|
|
|
54
58
|
}
|
|
55
59
|
},
|
|
56
60
|
define: {
|
|
61
|
+
...(_s = (_r = viteConfig === null || viteConfig === void 0 ? void 0 : viteConfig().server) === null || _r === void 0 ? void 0 : _r.otherConfig) === null || _s === void 0 ? void 0 : _s.define,
|
|
57
62
|
__isBrowser__: false,
|
|
58
63
|
...define === null || define === void 0 ? void 0 : define.base,
|
|
59
64
|
...define === null || define === void 0 ? void 0 : define.server
|
|
@@ -62,31 +67,41 @@ const serverConfig = {
|
|
|
62
67
|
exports.serverConfig = serverConfig;
|
|
63
68
|
const clientConfig = {
|
|
64
69
|
...(0, ssr_server_utils_1.commonConfig)(),
|
|
65
|
-
...(
|
|
70
|
+
...(_t = viteConfig === null || viteConfig === void 0 ? void 0 : viteConfig().client) === null || _t === void 0 ? void 0 : _t.otherConfig,
|
|
66
71
|
base: isDev ? '/' : (0, ssr_server_utils_1.getOutputPublicPath)(),
|
|
67
72
|
esbuild: {
|
|
68
|
-
|
|
73
|
+
...(_v = (_u = viteConfig === null || viteConfig === void 0 ? void 0 : viteConfig().client) === null || _u === void 0 ? void 0 : _u.otherConfig) === null || _v === void 0 ? void 0 : _v.esbuild,
|
|
74
|
+
keepNames: true,
|
|
75
|
+
logOverride: { 'this-is-undefined-in-esm': 'silent' }
|
|
76
|
+
},
|
|
77
|
+
optimizeDeps: {
|
|
78
|
+
...(_x = (_w = viteConfig === null || viteConfig === void 0 ? void 0 : viteConfig().client) === null || _w === void 0 ? void 0 : _w.otherConfig) === null || _x === void 0 ? void 0 : _x.optimizeDeps,
|
|
79
|
+
include: ['react-router'].concat(...(_1 = (_0 = (_z = (_y = viteConfig === null || viteConfig === void 0 ? void 0 : viteConfig().client) === null || _y === void 0 ? void 0 : _y.otherConfig) === null || _z === void 0 ? void 0 : _z.optimizeDeps) === null || _0 === void 0 ? void 0 : _0.include) !== null && _1 !== void 0 ? _1 : []),
|
|
80
|
+
exclude: ['ssr-hoc-react'].concat(...(_5 = (_4 = (_3 = (_2 = viteConfig === null || viteConfig === void 0 ? void 0 : viteConfig().client) === null || _2 === void 0 ? void 0 : _2.otherConfig) === null || _3 === void 0 ? void 0 : _3.optimizeDeps) === null || _4 === void 0 ? void 0 : _4.exclude) !== null && _5 !== void 0 ? _5 : [])
|
|
69
81
|
},
|
|
70
82
|
plugins: [
|
|
71
83
|
(0, plugin_react_1.default)({
|
|
72
|
-
...(
|
|
84
|
+
...(_7 = (_6 = viteConfig === null || viteConfig === void 0 ? void 0 : viteConfig()) === null || _6 === void 0 ? void 0 : _6.client) === null || _7 === void 0 ? void 0 : _7.defaultPluginOptions,
|
|
73
85
|
jsxRuntime: 'classic',
|
|
74
86
|
...babelOptions
|
|
75
87
|
}),
|
|
76
|
-
(
|
|
77
|
-
(
|
|
88
|
+
(_9 = (_8 = viteConfig === null || viteConfig === void 0 ? void 0 : viteConfig()) === null || _8 === void 0 ? void 0 : _8.common) === null || _9 === void 0 ? void 0 : _9.extraPlugin,
|
|
89
|
+
(_11 = (_10 = viteConfig === null || viteConfig === void 0 ? void 0 : viteConfig()) === null || _10 === void 0 ? void 0 : _10.client) === null || _11 === void 0 ? void 0 : _11.extraPlugin,
|
|
78
90
|
(0, ssr_vite_plugin_style_import_1.createStyleImportPlugin)(styleImportConfig)
|
|
79
91
|
],
|
|
80
92
|
build: {
|
|
93
|
+
...(_13 = (_12 = viteConfig === null || viteConfig === void 0 ? void 0 : viteConfig().client) === null || _12 === void 0 ? void 0 : _12.otherConfig) === null || _13 === void 0 ? void 0 : _13.build,
|
|
81
94
|
ssrManifest: true,
|
|
82
95
|
outDir: clientOutPut,
|
|
83
96
|
rollupOptions: {
|
|
97
|
+
...(_16 = (_15 = (_14 = viteConfig === null || viteConfig === void 0 ? void 0 : viteConfig().client) === null || _14 === void 0 ? void 0 : _14.otherConfig) === null || _15 === void 0 ? void 0 : _15.build) === null || _16 === void 0 ? void 0 : _16.rollupOptions,
|
|
84
98
|
input: reactClientEntry,
|
|
85
99
|
output: ssr_server_utils_1.rollupOutputOptions,
|
|
86
100
|
plugins: [(0, ssr_server_utils_1.chunkNamePlugin)(), (0, ssr_server_utils_1.asyncOptimizeChunkPlugin)(), (0, ssr_server_utils_1.manifestPlugin)()]
|
|
87
101
|
}
|
|
88
102
|
},
|
|
89
103
|
define: {
|
|
104
|
+
...(_18 = (_17 = viteConfig === null || viteConfig === void 0 ? void 0 : viteConfig().client) === null || _17 === void 0 ? void 0 : _17.otherConfig) === null || _18 === void 0 ? void 0 : _18.define,
|
|
90
105
|
__isBrowser__: true,
|
|
91
106
|
...define === null || define === void 0 ? void 0 : define.base,
|
|
92
107
|
...define === null || define === void 0 ? void 0 : define.client
|
|
@@ -102,3 +117,11 @@ const viteBuild = async () => {
|
|
|
102
117
|
await (0, vite_1.build)({ ...serverConfig, mode: 'production' });
|
|
103
118
|
};
|
|
104
119
|
exports.viteBuild = viteBuild;
|
|
120
|
+
const viteBuildClient = async () => {
|
|
121
|
+
await (0, vite_1.build)({ ...clientConfig, mode: 'production' });
|
|
122
|
+
};
|
|
123
|
+
exports.viteBuildClient = viteBuildClient;
|
|
124
|
+
const viteBuildServer = async () => {
|
|
125
|
+
await (0, vite_1.build)({ ...serverConfig, mode: 'production' });
|
|
126
|
+
};
|
|
127
|
+
exports.viteBuildServer = viteBuildServer;
|
package/esm/config/client.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/config/client.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,YAAY,MAAM,eAAe,CAAA;AAW7C,QAAA,MAAM,gBAAgB,UAAW,YAAY,
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/config/client.ts"],"names":[],"mappings":";AAGA,OAAO,KAAK,YAAY,MAAM,eAAe,CAAA;AAW7C,QAAA,MAAM,gBAAgB,UAAW,YAAY,oCAiG5C,CAAA;AAED,OAAO,EACL,gBAAgB,EACjB,CAAA"}
|
package/esm/config/client.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { promises } from 'fs';
|
|
2
2
|
import { resolve } from 'path';
|
|
3
|
-
import { loadConfig, getCwd,
|
|
3
|
+
import { loadConfig, getCwd, getSplitChunksOptions, getOutputPublicPath, loadModuleFromFramework } from 'ssr-server-utils';
|
|
4
4
|
import { getBaseConfig } from './base';
|
|
5
5
|
const ModuleNotFoundPlugin = require('react-dev-utils/ModuleNotFoundPlugin');
|
|
6
6
|
const safePostCssParser = require('postcss-safe-parser');
|
|
@@ -10,7 +10,7 @@ const generateAnalysis = Boolean(process.env.GENERATE_ANALYSIS);
|
|
|
10
10
|
const loadModule = loadModuleFromFramework;
|
|
11
11
|
let asyncChunkMap = {};
|
|
12
12
|
const getClientWebpack = (chain) => {
|
|
13
|
-
const { isDev, chunkName, getOutput, cwd, useHash, chainClientConfig, host, fePort } = loadConfig();
|
|
13
|
+
const { isDev, chunkName, getOutput, cwd, useHash, chainClientConfig, host, fePort, optimize } = loadConfig();
|
|
14
14
|
const shouldUseSourceMap = isDev || Boolean(process.env.GENERATE_SOURCEMAP);
|
|
15
15
|
const publicPath = getOutputPublicPath();
|
|
16
16
|
getBaseConfig(chain, false);
|
|
@@ -26,22 +26,7 @@ const getClientWebpack = (chain) => {
|
|
|
26
26
|
.end();
|
|
27
27
|
chain.optimization
|
|
28
28
|
.runtimeChunk(true)
|
|
29
|
-
.splitChunks(
|
|
30
|
-
chunks: 'all',
|
|
31
|
-
name(module, chunks, cacheGroupKey) {
|
|
32
|
-
return cryptoAsyncChunkName(chunks, asyncChunkMap);
|
|
33
|
-
},
|
|
34
|
-
cacheGroups: {
|
|
35
|
-
vendors: {
|
|
36
|
-
test: (module) => {
|
|
37
|
-
return module.resource &&
|
|
38
|
-
/\.js$/.test(module.resource) &&
|
|
39
|
-
module.resource.match('node_modules');
|
|
40
|
-
},
|
|
41
|
-
name: 'vendor'
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
})
|
|
29
|
+
.splitChunks(getSplitChunksOptions(asyncChunkMap))
|
|
45
30
|
.when(!isDev, optimization => {
|
|
46
31
|
optimization.minimizer('terser')
|
|
47
32
|
.use(loadModule('terser-webpack-plugin'), [{
|
|
@@ -102,7 +87,9 @@ const getClientWebpack = (chain) => {
|
|
|
102
87
|
asyncChunkMap = {};
|
|
103
88
|
});
|
|
104
89
|
compiler.hooks.done.tapAsync('WriteAsyncChunkManifest', async (params, callback) => {
|
|
105
|
-
|
|
90
|
+
if (!optimize) {
|
|
91
|
+
await promises.writeFile(resolve(getCwd(), './build/asyncChunkMap.json'), JSON.stringify(asyncChunkMap));
|
|
92
|
+
}
|
|
106
93
|
callback();
|
|
107
94
|
});
|
|
108
95
|
}
|
|
@@ -61,9 +61,9 @@ const serverRender = async (ctx, config) => {
|
|
|
61
61
|
}
|
|
62
62
|
const combineData = isCsr ? null : Object.assign(state !== null && state !== void 0 ? state : {}, layoutFetchData !== null && layoutFetchData !== void 0 ? layoutFetchData : {}, fetchData !== null && fetchData !== void 0 ? fetchData : {});
|
|
63
63
|
const injectState = isCsr ? React.createElement("script", { dangerouslySetInnerHTML: { __html: `window.prefix="${prefix}"` } }) : React.createElement("script", { dangerouslySetInnerHTML: {
|
|
64
|
-
__html: `window.__USE_SSR__=true; window.__INITIAL_DATA__ =${serialize(combineData)}; window.prefix="${prefix}";${clientPrefix
|
|
64
|
+
__html: `window.__USE_SSR__=true; window.__INITIAL_DATA__ =${serialize(combineData)}; window.prefix="${prefix}";${clientPrefix ? `window.clientPrefix="${clientPrefix}";` : ''}`
|
|
65
65
|
} });
|
|
66
|
-
return (React.createElement(StaticRouter, { location: ctx.request.url },
|
|
66
|
+
return (React.createElement(StaticRouter, { location: ctx.request.url, basename: prefix },
|
|
67
67
|
React.createElement(Context.Provider, { value: { state: combineData } },
|
|
68
68
|
React.createElement(Layout, { ctx: ctx, config: config, staticList: staticList, injectState: injectState },
|
|
69
69
|
React.createElement(Component, null)))));
|
package/esm/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,wBAAgB,YAAY;;;;EA6B3B;AAED,cAAc,cAAc,CAAA"}
|
package/esm/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { loadConfig } from 'ssr-server-utils';
|
|
2
|
-
const { isVite } = loadConfig();
|
|
1
|
+
import { loadConfig, cleanOutClientDir } from 'ssr-server-utils';
|
|
2
|
+
const { isVite, optimize } = loadConfig();
|
|
3
|
+
const spinner = require('ora')('Building');
|
|
3
4
|
export function clientPlugin() {
|
|
4
5
|
return {
|
|
5
6
|
name: 'plugin-react',
|
|
@@ -19,6 +20,13 @@ export function clientPlugin() {
|
|
|
19
20
|
await viteBuild();
|
|
20
21
|
}
|
|
21
22
|
else {
|
|
23
|
+
if (optimize) {
|
|
24
|
+
spinner.start();
|
|
25
|
+
const { viteBuildClient } = await import('./tools/vite');
|
|
26
|
+
await viteBuildClient();
|
|
27
|
+
cleanOutClientDir();
|
|
28
|
+
spinner.stop();
|
|
29
|
+
}
|
|
22
30
|
const { webpackBuild } = await import('./tools/webpack');
|
|
23
31
|
await webpackBuild();
|
|
24
32
|
}
|
package/esm/tools/vite.d.ts
CHANGED
|
@@ -3,5 +3,7 @@ declare const serverConfig: UserConfig;
|
|
|
3
3
|
declare const clientConfig: UserConfig;
|
|
4
4
|
declare const viteStart: () => Promise<void>;
|
|
5
5
|
declare const viteBuild: () => Promise<void>;
|
|
6
|
-
|
|
6
|
+
declare const viteBuildClient: () => Promise<void>;
|
|
7
|
+
declare const viteBuildServer: () => Promise<void>;
|
|
8
|
+
export { viteBuild, viteStart, serverConfig, clientConfig, viteBuildClient, viteBuildServer };
|
|
7
9
|
//# sourceMappingURL=vite.d.ts.map
|
package/esm/tools/vite.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vite.d.ts","sourceRoot":"","sources":["../../src/tools/vite.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,UAAU,EAAE,MAAM,MAAM,CAAA;AAgBxC,QAAA,MAAM,YAAY,EAAE,
|
|
1
|
+
{"version":3,"file":"vite.d.ts","sourceRoot":"","sources":["../../src/tools/vite.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,UAAU,EAAE,MAAM,MAAM,CAAA;AAgBxC,QAAA,MAAM,YAAY,EAAE,UA6CnB,CAAA;AACD,QAAA,MAAM,YAAY,EAAE,UAyCnB,CAAA;AACD,QAAA,MAAM,SAAS,qBAEd,CAAA;AACD,QAAA,MAAM,SAAS,qBAGd,CAAA;AAED,QAAA,MAAM,eAAe,qBAEpB,CAAA;AACD,QAAA,MAAM,eAAe,qBAEpB,CAAA;AAED,OAAO,EACL,SAAS,EACT,SAAS,EACT,YAAY,EACZ,YAAY,EACZ,eAAe,EACf,eAAe,EAChB,CAAA"}
|
package/esm/tools/vite.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
1
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18;
|
|
2
2
|
import { build } from 'vite';
|
|
3
3
|
import { loadConfig, chunkNamePlugin, rollupOutputOptions, manifestPlugin, commonConfig, asyncOptimizeChunkPlugin, getOutputPublicPath } from 'ssr-server-utils';
|
|
4
4
|
import react from '@vitejs/plugin-react';
|
|
@@ -38,12 +38,16 @@ const serverConfig = {
|
|
|
38
38
|
createStyleImportPlugin(styleImportConfig)
|
|
39
39
|
],
|
|
40
40
|
esbuild: {
|
|
41
|
-
|
|
41
|
+
...(_k = (_j = viteConfig === null || viteConfig === void 0 ? void 0 : viteConfig().server) === null || _j === void 0 ? void 0 : _j.otherConfig) === null || _k === void 0 ? void 0 : _k.esbuild,
|
|
42
|
+
keepNames: true,
|
|
43
|
+
logOverride: { 'this-is-undefined-in-esm': 'silent' }
|
|
42
44
|
},
|
|
43
45
|
build: {
|
|
46
|
+
...(_m = (_l = viteConfig === null || viteConfig === void 0 ? void 0 : viteConfig().server) === null || _l === void 0 ? void 0 : _l.otherConfig) === null || _m === void 0 ? void 0 : _m.build,
|
|
44
47
|
ssr: reactServerEntry,
|
|
45
48
|
outDir: serverOutPut,
|
|
46
49
|
rollupOptions: {
|
|
50
|
+
...(_q = (_p = (_o = viteConfig === null || viteConfig === void 0 ? void 0 : viteConfig().server) === null || _o === void 0 ? void 0 : _o.otherConfig) === null || _p === void 0 ? void 0 : _p.build) === null || _q === void 0 ? void 0 : _q.rollupOptions,
|
|
47
51
|
input: isDev ? reactClientEntry : reactServerEntry,
|
|
48
52
|
output: {
|
|
49
53
|
entryFileNames: 'Page.server.js'
|
|
@@ -51,6 +55,7 @@ const serverConfig = {
|
|
|
51
55
|
}
|
|
52
56
|
},
|
|
53
57
|
define: {
|
|
58
|
+
...(_s = (_r = viteConfig === null || viteConfig === void 0 ? void 0 : viteConfig().server) === null || _r === void 0 ? void 0 : _r.otherConfig) === null || _s === void 0 ? void 0 : _s.define,
|
|
54
59
|
__isBrowser__: false,
|
|
55
60
|
...define === null || define === void 0 ? void 0 : define.base,
|
|
56
61
|
...define === null || define === void 0 ? void 0 : define.server
|
|
@@ -58,31 +63,41 @@ const serverConfig = {
|
|
|
58
63
|
};
|
|
59
64
|
const clientConfig = {
|
|
60
65
|
...commonConfig(),
|
|
61
|
-
...(
|
|
66
|
+
...(_t = viteConfig === null || viteConfig === void 0 ? void 0 : viteConfig().client) === null || _t === void 0 ? void 0 : _t.otherConfig,
|
|
62
67
|
base: isDev ? '/' : getOutputPublicPath(),
|
|
63
68
|
esbuild: {
|
|
64
|
-
|
|
69
|
+
...(_v = (_u = viteConfig === null || viteConfig === void 0 ? void 0 : viteConfig().client) === null || _u === void 0 ? void 0 : _u.otherConfig) === null || _v === void 0 ? void 0 : _v.esbuild,
|
|
70
|
+
keepNames: true,
|
|
71
|
+
logOverride: { 'this-is-undefined-in-esm': 'silent' }
|
|
72
|
+
},
|
|
73
|
+
optimizeDeps: {
|
|
74
|
+
...(_x = (_w = viteConfig === null || viteConfig === void 0 ? void 0 : viteConfig().client) === null || _w === void 0 ? void 0 : _w.otherConfig) === null || _x === void 0 ? void 0 : _x.optimizeDeps,
|
|
75
|
+
include: ['react-router'].concat(...(_1 = (_0 = (_z = (_y = viteConfig === null || viteConfig === void 0 ? void 0 : viteConfig().client) === null || _y === void 0 ? void 0 : _y.otherConfig) === null || _z === void 0 ? void 0 : _z.optimizeDeps) === null || _0 === void 0 ? void 0 : _0.include) !== null && _1 !== void 0 ? _1 : []),
|
|
76
|
+
exclude: ['ssr-hoc-react'].concat(...(_5 = (_4 = (_3 = (_2 = viteConfig === null || viteConfig === void 0 ? void 0 : viteConfig().client) === null || _2 === void 0 ? void 0 : _2.otherConfig) === null || _3 === void 0 ? void 0 : _3.optimizeDeps) === null || _4 === void 0 ? void 0 : _4.exclude) !== null && _5 !== void 0 ? _5 : [])
|
|
65
77
|
},
|
|
66
78
|
plugins: [
|
|
67
79
|
react({
|
|
68
|
-
...(
|
|
80
|
+
...(_7 = (_6 = viteConfig === null || viteConfig === void 0 ? void 0 : viteConfig()) === null || _6 === void 0 ? void 0 : _6.client) === null || _7 === void 0 ? void 0 : _7.defaultPluginOptions,
|
|
69
81
|
jsxRuntime: 'classic',
|
|
70
82
|
...babelOptions
|
|
71
83
|
}),
|
|
72
|
-
(
|
|
73
|
-
(
|
|
84
|
+
(_9 = (_8 = viteConfig === null || viteConfig === void 0 ? void 0 : viteConfig()) === null || _8 === void 0 ? void 0 : _8.common) === null || _9 === void 0 ? void 0 : _9.extraPlugin,
|
|
85
|
+
(_11 = (_10 = viteConfig === null || viteConfig === void 0 ? void 0 : viteConfig()) === null || _10 === void 0 ? void 0 : _10.client) === null || _11 === void 0 ? void 0 : _11.extraPlugin,
|
|
74
86
|
createStyleImportPlugin(styleImportConfig)
|
|
75
87
|
],
|
|
76
88
|
build: {
|
|
89
|
+
...(_13 = (_12 = viteConfig === null || viteConfig === void 0 ? void 0 : viteConfig().client) === null || _12 === void 0 ? void 0 : _12.otherConfig) === null || _13 === void 0 ? void 0 : _13.build,
|
|
77
90
|
ssrManifest: true,
|
|
78
91
|
outDir: clientOutPut,
|
|
79
92
|
rollupOptions: {
|
|
93
|
+
...(_16 = (_15 = (_14 = viteConfig === null || viteConfig === void 0 ? void 0 : viteConfig().client) === null || _14 === void 0 ? void 0 : _14.otherConfig) === null || _15 === void 0 ? void 0 : _15.build) === null || _16 === void 0 ? void 0 : _16.rollupOptions,
|
|
80
94
|
input: reactClientEntry,
|
|
81
95
|
output: rollupOutputOptions,
|
|
82
96
|
plugins: [chunkNamePlugin(), asyncOptimizeChunkPlugin(), manifestPlugin()]
|
|
83
97
|
}
|
|
84
98
|
},
|
|
85
99
|
define: {
|
|
100
|
+
...(_18 = (_17 = viteConfig === null || viteConfig === void 0 ? void 0 : viteConfig().client) === null || _17 === void 0 ? void 0 : _17.otherConfig) === null || _18 === void 0 ? void 0 : _18.define,
|
|
86
101
|
__isBrowser__: true,
|
|
87
102
|
...define === null || define === void 0 ? void 0 : define.base,
|
|
88
103
|
...define === null || define === void 0 ? void 0 : define.client
|
|
@@ -95,4 +110,10 @@ const viteBuild = async () => {
|
|
|
95
110
|
await build({ ...clientConfig, mode: 'production' });
|
|
96
111
|
await build({ ...serverConfig, mode: 'production' });
|
|
97
112
|
};
|
|
98
|
-
|
|
113
|
+
const viteBuildClient = async () => {
|
|
114
|
+
await build({ ...clientConfig, mode: 'production' });
|
|
115
|
+
};
|
|
116
|
+
const viteBuildServer = async () => {
|
|
117
|
+
await build({ ...serverConfig, mode: 'production' });
|
|
118
|
+
};
|
|
119
|
+
export { viteBuild, viteStart, serverConfig, clientConfig, viteBuildClient, viteBuildServer };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ssr-plugin-react",
|
|
3
|
-
"version": "6.2.
|
|
3
|
+
"version": "6.2.28",
|
|
4
4
|
"description": "plugin-react for ssr",
|
|
5
5
|
"main": "./cjs/index.js",
|
|
6
6
|
"module": "./esm/index.js",
|
|
@@ -46,6 +46,7 @@
|
|
|
46
46
|
"less-loader": "^7.3.0",
|
|
47
47
|
"mini-css-extract-plugin": "^1.0.0",
|
|
48
48
|
"optimize-css-assets-webpack-plugin": "^6.0.0",
|
|
49
|
+
"ora": "^4.0.4",
|
|
49
50
|
"postcss": "^8.0.0",
|
|
50
51
|
"postcss-discard-comments": "^5.0.0",
|
|
51
52
|
"postcss-flexbugs-fixes": "^5.0.0",
|
|
@@ -59,15 +60,15 @@
|
|
|
59
60
|
"react-refresh": "^0.12.0",
|
|
60
61
|
"react-router": "^5.2.1",
|
|
61
62
|
"react-router-dom": "^5.1.2",
|
|
62
|
-
"ssr-serialize-javascript": "^6.0.0",
|
|
63
63
|
"ssr-client-utils": "^6.2.7",
|
|
64
64
|
"ssr-hoc-react": "^6.2.7",
|
|
65
|
+
"ssr-serialize-javascript": "^6.0.0",
|
|
65
66
|
"ssr-server-utils": "^6.2.10",
|
|
67
|
+
"ssr-vite-plugin-style-import": "^2.0.0",
|
|
66
68
|
"ssr-webpack": "^6.2.10",
|
|
67
69
|
"terser-webpack-plugin": "^2.3.5",
|
|
68
70
|
"url-loader": "^4.1.1",
|
|
69
|
-
"vite": "2.
|
|
70
|
-
"ssr-vite-plugin-style-import": "^2.0.0",
|
|
71
|
+
"vite": "^2.9.13",
|
|
71
72
|
"webpack": "^4.42.1",
|
|
72
73
|
"webpack-bundle-analyzer": "^3.6.1",
|
|
73
74
|
"webpack-chain": "^6.4.0",
|
package/src/config/client.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { promises } from 'fs'
|
|
2
2
|
import { resolve } from 'path'
|
|
3
|
-
import { loadConfig, getCwd,
|
|
3
|
+
import { loadConfig, getCwd, getSplitChunksOptions, getOutputPublicPath, loadModuleFromFramework } from 'ssr-server-utils'
|
|
4
4
|
import * as WebpackChain from 'webpack-chain'
|
|
5
5
|
import { getBaseConfig } from './base'
|
|
6
6
|
|
|
@@ -13,7 +13,7 @@ const loadModule = loadModuleFromFramework
|
|
|
13
13
|
let asyncChunkMap: Record<string, string[]> = {}
|
|
14
14
|
|
|
15
15
|
const getClientWebpack = (chain: WebpackChain) => {
|
|
16
|
-
const { isDev, chunkName, getOutput, cwd, useHash, chainClientConfig, host, fePort } = loadConfig()
|
|
16
|
+
const { isDev, chunkName, getOutput, cwd, useHash, chainClientConfig, host, fePort, optimize } = loadConfig()
|
|
17
17
|
const shouldUseSourceMap = isDev || Boolean(process.env.GENERATE_SOURCEMAP)
|
|
18
18
|
const publicPath = getOutputPublicPath()
|
|
19
19
|
getBaseConfig(chain, false)
|
|
@@ -29,22 +29,7 @@ const getClientWebpack = (chain: WebpackChain) => {
|
|
|
29
29
|
.end()
|
|
30
30
|
chain.optimization
|
|
31
31
|
.runtimeChunk(true)
|
|
32
|
-
.splitChunks(
|
|
33
|
-
chunks: 'all',
|
|
34
|
-
name (module: any, chunks: any, cacheGroupKey: string) {
|
|
35
|
-
return cryptoAsyncChunkName(chunks, asyncChunkMap)
|
|
36
|
-
},
|
|
37
|
-
cacheGroups: {
|
|
38
|
-
vendors: {
|
|
39
|
-
test: (module: any) => {
|
|
40
|
-
return module.resource &&
|
|
41
|
-
/\.js$/.test(module.resource) &&
|
|
42
|
-
module.resource.match('node_modules')
|
|
43
|
-
},
|
|
44
|
-
name: 'vendor'
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
})
|
|
32
|
+
.splitChunks(getSplitChunksOptions(asyncChunkMap))
|
|
48
33
|
.when(!isDev, optimization => {
|
|
49
34
|
optimization.minimizer('terser')
|
|
50
35
|
.use(loadModule('terser-webpack-plugin'), [{
|
|
@@ -112,7 +97,9 @@ const getClientWebpack = (chain: WebpackChain) => {
|
|
|
112
97
|
compiler.hooks.done.tapAsync(
|
|
113
98
|
'WriteAsyncChunkManifest',
|
|
114
99
|
async (params: any, callback: any) => {
|
|
115
|
-
|
|
100
|
+
if (!optimize) {
|
|
101
|
+
await promises.writeFile(resolve(getCwd(), './build/asyncChunkMap.json'), JSON.stringify(asyncChunkMap))
|
|
102
|
+
}
|
|
116
103
|
callback()
|
|
117
104
|
}
|
|
118
105
|
)
|
|
@@ -69,11 +69,11 @@ const serverRender = async (ctx: ISSRContext, config: IConfig): Promise<React.Re
|
|
|
69
69
|
}
|
|
70
70
|
const combineData = isCsr ? null : Object.assign(state ?? {}, layoutFetchData ?? {}, fetchData ?? {})
|
|
71
71
|
const injectState = isCsr ? <script dangerouslySetInnerHTML={{ __html: `window.prefix="${prefix}"` }} /> : <script dangerouslySetInnerHTML={{
|
|
72
|
-
__html: `window.__USE_SSR__=true; window.__INITIAL_DATA__ =${serialize(combineData)}; window.prefix="${prefix}";${clientPrefix
|
|
72
|
+
__html: `window.__USE_SSR__=true; window.__INITIAL_DATA__ =${serialize(combineData)}; window.prefix="${prefix}";${clientPrefix ? `window.clientPrefix="${clientPrefix}";` : ''}`
|
|
73
73
|
}} />
|
|
74
74
|
|
|
75
75
|
return (
|
|
76
|
-
<StaticRouter location={ctx.request.url}>
|
|
76
|
+
<StaticRouter location={ctx.request.url} basename={prefix}>
|
|
77
77
|
<Context.Provider value={{ state: combineData }}>
|
|
78
78
|
<Layout ctx={ctx} config={config} staticList={staticList} injectState={injectState}>
|
|
79
79
|
<Component />
|
package/src/index.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { loadConfig } from 'ssr-server-utils'
|
|
1
|
+
import { loadConfig, cleanOutClientDir } from 'ssr-server-utils'
|
|
2
|
+
|
|
3
|
+
const { isVite, optimize } = loadConfig()
|
|
4
|
+
const spinner = require('ora')('Building')
|
|
2
5
|
|
|
3
|
-
const { isVite } = loadConfig()
|
|
4
6
|
export function clientPlugin () {
|
|
5
7
|
return {
|
|
6
8
|
name: 'plugin-react',
|
|
@@ -18,6 +20,13 @@ export function clientPlugin () {
|
|
|
18
20
|
const { viteBuild } = await import('./tools/vite')
|
|
19
21
|
await viteBuild()
|
|
20
22
|
} else {
|
|
23
|
+
if (optimize) {
|
|
24
|
+
spinner.start()
|
|
25
|
+
const { viteBuildClient } = await import('./tools/vite')
|
|
26
|
+
await viteBuildClient()
|
|
27
|
+
cleanOutClientDir()
|
|
28
|
+
spinner.stop()
|
|
29
|
+
}
|
|
21
30
|
const { webpackBuild } = await import('./tools/webpack')
|
|
22
31
|
await webpackBuild()
|
|
23
32
|
}
|
package/src/tools/vite.ts
CHANGED
|
@@ -37,12 +37,16 @@ const serverConfig: UserConfig = {
|
|
|
37
37
|
createStyleImportPlugin(styleImportConfig)
|
|
38
38
|
],
|
|
39
39
|
esbuild: {
|
|
40
|
-
|
|
40
|
+
...viteConfig?.().server?.otherConfig?.esbuild,
|
|
41
|
+
keepNames: true,
|
|
42
|
+
logOverride: { 'this-is-undefined-in-esm': 'silent' }
|
|
41
43
|
},
|
|
42
44
|
build: {
|
|
45
|
+
...viteConfig?.().server?.otherConfig?.build,
|
|
43
46
|
ssr: reactServerEntry,
|
|
44
47
|
outDir: serverOutPut,
|
|
45
48
|
rollupOptions: {
|
|
49
|
+
...viteConfig?.().server?.otherConfig?.build?.rollupOptions,
|
|
46
50
|
input: isDev ? reactClientEntry : reactServerEntry, // setting prebundle list by client-entry in dev
|
|
47
51
|
output: {
|
|
48
52
|
entryFileNames: 'Page.server.js'
|
|
@@ -50,6 +54,7 @@ const serverConfig: UserConfig = {
|
|
|
50
54
|
}
|
|
51
55
|
},
|
|
52
56
|
define: {
|
|
57
|
+
...viteConfig?.().server?.otherConfig?.define,
|
|
53
58
|
__isBrowser__: false,
|
|
54
59
|
...define?.base,
|
|
55
60
|
...define?.server
|
|
@@ -60,7 +65,14 @@ const clientConfig: UserConfig = {
|
|
|
60
65
|
...viteConfig?.().client?.otherConfig,
|
|
61
66
|
base: isDev ? '/' : getOutputPublicPath(),
|
|
62
67
|
esbuild: {
|
|
63
|
-
|
|
68
|
+
...viteConfig?.().client?.otherConfig?.esbuild,
|
|
69
|
+
keepNames: true,
|
|
70
|
+
logOverride: { 'this-is-undefined-in-esm': 'silent' }
|
|
71
|
+
},
|
|
72
|
+
optimizeDeps: {
|
|
73
|
+
...viteConfig?.().client?.otherConfig?.optimizeDeps,
|
|
74
|
+
include: ['react-router'].concat(...viteConfig?.().client?.otherConfig?.optimizeDeps?.include ?? []),
|
|
75
|
+
exclude: ['ssr-hoc-react'].concat(...viteConfig?.().client?.otherConfig?.optimizeDeps?.exclude ?? [])
|
|
64
76
|
},
|
|
65
77
|
plugins: [
|
|
66
78
|
react({
|
|
@@ -73,15 +85,18 @@ const clientConfig: UserConfig = {
|
|
|
73
85
|
createStyleImportPlugin(styleImportConfig)
|
|
74
86
|
],
|
|
75
87
|
build: {
|
|
88
|
+
...viteConfig?.().client?.otherConfig?.build,
|
|
76
89
|
ssrManifest: true,
|
|
77
90
|
outDir: clientOutPut,
|
|
78
91
|
rollupOptions: {
|
|
92
|
+
...viteConfig?.().client?.otherConfig?.build?.rollupOptions,
|
|
79
93
|
input: reactClientEntry,
|
|
80
94
|
output: rollupOutputOptions,
|
|
81
95
|
plugins: [chunkNamePlugin(), asyncOptimizeChunkPlugin(), manifestPlugin()]
|
|
82
96
|
}
|
|
83
97
|
},
|
|
84
98
|
define: {
|
|
99
|
+
...viteConfig?.().client?.otherConfig?.define,
|
|
85
100
|
__isBrowser__: true,
|
|
86
101
|
...define?.base,
|
|
87
102
|
...define?.client
|
|
@@ -95,9 +110,18 @@ const viteBuild = async () => {
|
|
|
95
110
|
await build({ ...serverConfig, mode: 'production' })
|
|
96
111
|
}
|
|
97
112
|
|
|
113
|
+
const viteBuildClient = async () => {
|
|
114
|
+
await build({ ...clientConfig, mode: 'production' })
|
|
115
|
+
}
|
|
116
|
+
const viteBuildServer = async () => {
|
|
117
|
+
await build({ ...serverConfig, mode: 'production' })
|
|
118
|
+
}
|
|
119
|
+
|
|
98
120
|
export {
|
|
99
121
|
viteBuild,
|
|
100
122
|
viteStart,
|
|
101
123
|
serverConfig,
|
|
102
|
-
clientConfig
|
|
124
|
+
clientConfig,
|
|
125
|
+
viteBuildClient,
|
|
126
|
+
viteBuildServer
|
|
103
127
|
}
|