ssr-plugin-react 6.2.26 → 6.2.29

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 CHANGED
@@ -1,3 +1,267 @@
1
+ ## [6.2.29](https://github.com/zhangyuang/ssr/compare/v6.2.8...v6.2.29) (2022-07-12)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * add build:publish disable sourcemap ([ef82b29](https://github.com/zhangyuang/ssr/commit/ef82b298ddf19b72b130d76c33bfbca67339b139))
7
+ * add checkContains ([6cae390](https://github.com/zhangyuang/ssr/commit/6cae390785e9f0c7aeb1574322a840a7569a6f8e))
8
+ * 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))
9
+ * add watchCount ([de1cef1](https://github.com/zhangyuang/ssr/commit/de1cef1db9193bdbbc5a4ec330e04ebcb29dd25a))
10
+ * build html ([83be7be](https://github.com/zhangyuang/ssr/commit/83be7be185985a5dcbb9b8e846a5e2b14b94c1b0))
11
+ * build html ([59a8d7f](https://github.com/zhangyuang/ssr/commit/59a8d7f31bed703601e753d02db49ea5a0f93054))
12
+ * ci ([57e713f](https://github.com/zhangyuang/ssr/commit/57e713f1f96b4ceb893837c15c6032b23a0b1a4c))
13
+ * clearlastAsyncChunkMap ([81a605d](https://github.com/zhangyuang/ssr/commit/81a605d79786609c063cba62aeec971cc38ffe17))
14
+ * core-js types ([036bf38](https://github.com/zhangyuang/ssr/commit/036bf385d8ed804dfc2e46ef4484f7bf499d7cdb))
15
+ * don't throw error when load module failed ([2e5d077](https://github.com/zhangyuang/ssr/commit/2e5d077848dc10998a04fcccccc7c745c0d1bea7))
16
+ * fetch data after use pinia ([3d1a3f4](https://github.com/zhangyuang/ssr/commit/3d1a3f41d6f5c001c4e233aba25608147fdae2a2))
17
+ * fix config htmlTemplate read ([#191](https://github.com/zhangyuang/ssr/issues/191)) ([8c3e12b](https://github.com/zhangyuang/ssr/commit/8c3e12b6adb64b7898bc6232d980e72c5353026b))
18
+ * loadConfig ([8960c84](https://github.com/zhangyuang/ssr/commit/8960c84eea7b384d59ebfe6424813afec433b3f8))
19
+ * lock babel-plugin-import ([72c3041](https://github.com/zhangyuang/ssr/commit/72c3041bf61a1fc9b7593df1fdb6c4dc850c6bbd))
20
+ * lock vite version in plugin-react ([e015b75](https://github.com/zhangyuang/ssr/commit/e015b750c60dcae9a4a7e5fe14937177b80367ca))
21
+ * plugin-react without dynamic mode ([487cc84](https://github.com/zhangyuang/ssr/commit/487cc84188640aab13c27214df758da0d19e4368))
22
+ * postinstall ([fef24ba](https://github.com/zhangyuang/ssr/commit/fef24bada3498f162efd0bdd09921503e44ad21a))
23
+ * postinstall get correct path ([b3d1951](https://github.com/zhangyuang/ssr/commit/b3d1951b7537c5954fd040797fc0011a1d4439d7))
24
+ * react router basename in server entry ([#212](https://github.com/zhangyuang/ssr/issues/212)) ([28072f7](https://github.com/zhangyuang/ssr/commit/28072f7bdfc489a27599b636db33bdea18ef4c18))
25
+ * Recommended to specify used minor core-js version ([#207](https://github.com/zhangyuang/ssr/issues/207)) ([9db0424](https://github.com/zhangyuang/ssr/commit/9db0424e5e7ad1728d40665d01740f7a2c1c4b70))
26
+ * release utils ([1b9c56b](https://github.com/zhangyuang/ssr/commit/1b9c56bc904faa0cae39fb329c02b5d159d69872))
27
+ * restore webpack split chunks config ([2f7ae67](https://github.com/zhangyuang/ssr/commit/2f7ae67ecef863d56752a4a4e1fa7a75ec0756ed))
28
+ * revert vite build ([210ddea](https://github.com/zhangyuang/ssr/commit/210ddea22fc0639f60fcee96bdf47463d188e18f))
29
+ * update preinstall ([2b4b869](https://github.com/zhangyuang/ssr/commit/2b4b869c28b83b414bef10260e5561bc3773cea9))
30
+ * useStore types ([3532bfb](https://github.com/zhangyuang/ssr/commit/3532bfbef9981da300abf748a98925b59cc2c71d))
31
+ * vite build logic close [#221](https://github.com/zhangyuang/ssr/issues/221) ([297e2c0](https://github.com/zhangyuang/ssr/commit/297e2c0e5ad6609ce8cd3954a5886387f84343e6))
32
+ * vite mode config.base ([c64aa1a](https://github.com/zhangyuang/ssr/commit/c64aa1ab9d88cdfd7df1cce6feb43b191847e666))
33
+ * **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))
34
+ * void chunk logic ([ad694a1](https://github.com/zhangyuang/ssr/commit/ad694a1275f12560360f4e73c3466cce39b3e878))
35
+ * vue3 package.json ([c49fb14](https://github.com/zhangyuang/ssr/commit/c49fb146fc6ba79ffbeee567e334b560ffecbcac))
36
+ * whitList concat userconfig ([fdd971a](https://github.com/zhangyuang/ssr/commit/fdd971ab11aebc0f348d789e758183b877e791af))
37
+ * whitList concat userconfig ([e2328f8](https://github.com/zhangyuang/ssr/commit/e2328f87f5cfc18c9a30867e4f6e18d0df5c1ba3))
38
+
39
+
40
+ ### Features
41
+
42
+ * optimize code remove disableClientRender fix vite ([eeff477](https://github.com/zhangyuang/ssr/commit/eeff4770f8d9ff400289cf4d1ca4dd32883be108))
43
+ * add .vue to defaultWhiteList ([dbabfa2](https://github.com/zhangyuang/ssr/commit/dbabfa2864ec0a5487aadc31286da5630a8603fc))
44
+ * add `turbo` ([#196](https://github.com/zhangyuang/ssr/issues/196)) ([2be17bb](https://github.com/zhangyuang/ssr/commit/2be17bba5d80610b97b3813b3d4fe9579f88e5c3))
45
+ * add parseRoutes watcher when files changed remove webpack-chain in ([a499654](https://github.com/zhangyuang/ssr/commit/a49965470e2b1e1d9744b59baede586bdd5fff90))
46
+ * add ssr-common-utils ([c12a283](https://github.com/zhangyuang/ssr/commit/c12a283e0133285402f4af5cd0346b84f2aaf098))
47
+ * add ssr-serialize-javascript code optimize ([41bb14d](https://github.com/zhangyuang/ssr/commit/41bb14d31efd89d4a85d5220544d2f7a3883e1a3))
48
+ * add useStore ([b786b8c](https://github.com/zhangyuang/ssr/commit/b786b8cc314ce9d45d56ac68c93020209643b208))
49
+ * add viteConfig.ssr.external ([2035967](https://github.com/zhangyuang/ssr/commit/2035967def8d2f9d48997d6994efd8ffbb4fd382))
50
+ * babelExtraModule support vue ([06251e7](https://github.com/zhangyuang/ssr/commit/06251e716678e1f882f06f68f72c518a341de0d7))
51
+ * babelExtraModule support vue ([513073d](https://github.com/zhangyuang/ssr/commit/513073ddcecbb728d34eae233686a93d63355e00))
52
+ * change splitChunks from all to initial ([f0de225](https://github.com/zhangyuang/ssr/commit/f0de22566ff7769b02d3b7d7b75bde12a5b2c28a))
53
+ * don't cover viteConfig.build ([02aef3b](https://github.com/zhangyuang/ssr/commit/02aef3b44c1cde54d8586f0d73defdcdc7ce0ad3))
54
+ * don't emit void chunk ([dc5d8b7](https://github.com/zhangyuang/ssr/commit/dc5d8b742a9f97f2be38d9da633b9d1768b6710b))
55
+ * generate html file support inject prefix ([02741ee](https://github.com/zhangyuang/ssr/commit/02741eeda778eec26504c5e7e2c074b1d2402e83))
56
+ * move react-router to external ([0a58570](https://github.com/zhangyuang/ssr/commit/0a585705fb66d9f3a4a59008f1f3e82b23f05fae))
57
+ * optimize customescript ([f374760](https://github.com/zhangyuang/ssr/commit/f3747608d4684576875968394eca6315e2fa8dd1))
58
+ * plugin-midway remove luckyeye ([bb4b11f](https://github.com/zhangyuang/ssr/commit/bb4b11f289d060c8b332cf610bb6d8c4cf25142b))
59
+ * plugin-react add react-refresh, remove module.hot ([7bee211](https://github.com/zhangyuang/ssr/commit/7bee211ddfefaef688713f505756e1155320b844))
60
+ * remove plugin-nestjs deploy ([0ba16f8](https://github.com/zhangyuang/ssr/commit/0ba16f861b6dc679f216cbbcc931de75cdf79501))
61
+ * render add generic function overloading ([f03897f](https://github.com/zhangyuang/ssr/commit/f03897f07844d8fd5f9d2cf3eeef1a726da794bf))
62
+ * set argv.ssl for plugin-midway ([#213](https://github.com/zhangyuang/ssr/issues/213)) ([65c1cb9](https://github.com/zhangyuang/ssr/commit/65c1cb9da0772e915162dcd9b03fad2fada22b40))
63
+ * support htmlTemplate ([b240811](https://github.com/zhangyuang/ssr/commit/b2408114a6314ef4f96f4c06159d18fc6d881a57))
64
+ * support more vite config ([3ac5edc](https://github.com/zhangyuang/ssr/commit/3ac5edc605b59a1e1927fad0838cc730aba82b59))
65
+ * support props.ssrApp in vue3 ([8985037](https://github.com/zhangyuang/ssr/commit/898503753cbe69187d27f91c70dff3f4cd4a0b2a))
66
+ * support vite + wasm vite otherConfig ([7e65899](https://github.com/zhangyuang/ssr/commit/7e658998bc404c28374645c3a8a433a3db171f36))
67
+ * support vuex store options ([9bed529](https://github.com/zhangyuang/ssr/commit/9bed5299a59386e0cd70abbb8a66eca6090ed400))
68
+ * support wasm in webpack, lock postcss-preset-env version ([8ad50a4](https://github.com/zhangyuang/ssr/commit/8ad50a41227a8eb5395c955e5deeda7eb56036b0))
69
+ * support wildcare params ([c5cde18](https://github.com/zhangyuang/ssr/commit/c5cde18566365f9d3bbc81691c0ca5e7b72607d4))
70
+ * update chainBaseConfig ([51c1fbe](https://github.com/zhangyuang/ssr/commit/51c1fbe5a645d4701c7ebc035083096d50301891))
71
+ * update extraJsOrder extraCssOrder ([cd5ca99](https://github.com/zhangyuang/ssr/commit/cd5ca99a686ea565020500a6c4f77e310b422ce3))
72
+ * update fetch params ([70aedaa](https://github.com/zhangyuang/ssr/commit/70aedaa82a69552e22af1998bf1c2de8e30e0283))
73
+ * update midway deploy ([a473c59](https://github.com/zhangyuang/ssr/commit/a473c599657df42b4bf7a59f248b3c7c33907657))
74
+ * update plugin-vue3 support call pinia in fetch.ts ([958fdc7](https://github.com/zhangyuang/ssr/commit/958fdc787ab615593f3114a6bf2c6cea4823afc2))
75
+ * update ssr-common-utils ([c7cadc1](https://github.com/zhangyuang/ssr/commit/c7cadc14922383f8fdaa6c76b4dbe9c220d0ac72))
76
+ * update turbo ([9ee14f5](https://github.com/zhangyuang/ssr/commit/9ee14f59359187e35f4ef990998846ac3847347b))
77
+ * update vite config ([0596573](https://github.com/zhangyuang/ssr/commit/05965738898d96d53dedbd41746b8100dcc5653b))
78
+ * update vue example inject content for consistent ([c863c01](https://github.com/zhangyuang/ssr/commit/c863c011fc06ceed5d204d3d96eea29cf7c7d4b8))
79
+ * upgrade midway example to v3 ([572f7c5](https://github.com/zhangyuang/ssr/commit/572f7c5d171346cc17f5f6cdebe33aee76e0c146))
80
+ * 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))
81
+ * upgrade vue-router^2 to vue-router^3 ([283ed9e](https://github.com/zhangyuang/ssr/commit/283ed9ec4f6d8a622bcc3599ca33f9b0885ed3e5))
82
+ * use pnpm replace yarn workspace and lerna ([#186](https://github.com/zhangyuang/ssr/issues/186)) ([d578506](https://github.com/zhangyuang/ssr/commit/d578506160712847c1dd021b7759c7e9ff3c03e8))
83
+ * use ssr-vite-plugin-style-import ([1c8cac2](https://github.com/zhangyuang/ssr/commit/1c8cac2ff9bb7ec0132c23203efa5c85a8c7492e))
84
+ * use terser minify plugin-react server bundle ([0a3c7fe](https://github.com/zhangyuang/ssr/commit/0a3c7fe61908fe24bcb2d8c6394daf2afd18ba82))
85
+ * vite build extra vendor ([#210](https://github.com/zhangyuang/ssr/issues/210)) ([3eb6e4f](https://github.com/zhangyuang/ssr/commit/3eb6e4fde592a6ef59a7fd6790b56e38c187960d))
86
+ * vite build extra vendor and client-entry ([#211](https://github.com/zhangyuang/ssr/issues/211)) ([41fb1fe](https://github.com/zhangyuang/ssr/commit/41fb1fef04a1c954828d42e4dfe40445bcea444f))
87
+ * vite mode support splitChunk dynamic module ([4157fc2](https://github.com/zhangyuang/ssr/commit/4157fc24176b69c9815450b3623742995feae144))
88
+ * vue3 add default isCustomElement ([44ab37c](https://github.com/zhangyuang/ssr/commit/44ab37c27908b5927578d78a834d2404d42c70dd))
89
+ * vue3 support pinia, replace props.fetchData to props.reactiveFetchData in vue2/3 ([eabcb50](https://github.com/zhangyuang/ssr/commit/eabcb50729517b7cb649729d52356a06a010a8fc))
90
+ * webpack build optimize ([#222](https://github.com/zhangyuang/ssr/issues/222)) ([217dd38](https://github.com/zhangyuang/ssr/commit/217dd388c70d2a7d93d8eeec64a3d26136afe51b))
91
+
92
+
93
+
94
+ ## [6.2.28](https://github.com/zhangyuang/ssr/compare/v6.2.8...v6.2.28) (2022-07-11)
95
+
96
+
97
+ ### Bug Fixes
98
+
99
+ * add build:publish disable sourcemap ([ef82b29](https://github.com/zhangyuang/ssr/commit/ef82b298ddf19b72b130d76c33bfbca67339b139))
100
+ * 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))
101
+ * build html ([83be7be](https://github.com/zhangyuang/ssr/commit/83be7be185985a5dcbb9b8e846a5e2b14b94c1b0))
102
+ * build html ([59a8d7f](https://github.com/zhangyuang/ssr/commit/59a8d7f31bed703601e753d02db49ea5a0f93054))
103
+ * ci ([57e713f](https://github.com/zhangyuang/ssr/commit/57e713f1f96b4ceb893837c15c6032b23a0b1a4c))
104
+ * core-js types ([036bf38](https://github.com/zhangyuang/ssr/commit/036bf385d8ed804dfc2e46ef4484f7bf499d7cdb))
105
+ * don't throw error when load module failed ([2e5d077](https://github.com/zhangyuang/ssr/commit/2e5d077848dc10998a04fcccccc7c745c0d1bea7))
106
+ * fetch data after use pinia ([3d1a3f4](https://github.com/zhangyuang/ssr/commit/3d1a3f41d6f5c001c4e233aba25608147fdae2a2))
107
+ * fix config htmlTemplate read ([#191](https://github.com/zhangyuang/ssr/issues/191)) ([8c3e12b](https://github.com/zhangyuang/ssr/commit/8c3e12b6adb64b7898bc6232d980e72c5353026b))
108
+ * loadConfig ([8960c84](https://github.com/zhangyuang/ssr/commit/8960c84eea7b384d59ebfe6424813afec433b3f8))
109
+ * lock babel-plugin-import ([72c3041](https://github.com/zhangyuang/ssr/commit/72c3041bf61a1fc9b7593df1fdb6c4dc850c6bbd))
110
+ * lock vite version in plugin-react ([e015b75](https://github.com/zhangyuang/ssr/commit/e015b750c60dcae9a4a7e5fe14937177b80367ca))
111
+ * plugin-react without dynamic mode ([487cc84](https://github.com/zhangyuang/ssr/commit/487cc84188640aab13c27214df758da0d19e4368))
112
+ * postinstall ([fef24ba](https://github.com/zhangyuang/ssr/commit/fef24bada3498f162efd0bdd09921503e44ad21a))
113
+ * postinstall get correct path ([b3d1951](https://github.com/zhangyuang/ssr/commit/b3d1951b7537c5954fd040797fc0011a1d4439d7))
114
+ * react router basename in server entry ([#212](https://github.com/zhangyuang/ssr/issues/212)) ([28072f7](https://github.com/zhangyuang/ssr/commit/28072f7bdfc489a27599b636db33bdea18ef4c18))
115
+ * Recommended to specify used minor core-js version ([#207](https://github.com/zhangyuang/ssr/issues/207)) ([9db0424](https://github.com/zhangyuang/ssr/commit/9db0424e5e7ad1728d40665d01740f7a2c1c4b70))
116
+ * release utils ([1b9c56b](https://github.com/zhangyuang/ssr/commit/1b9c56bc904faa0cae39fb329c02b5d159d69872))
117
+ * restore webpack split chunks config ([2f7ae67](https://github.com/zhangyuang/ssr/commit/2f7ae67ecef863d56752a4a4e1fa7a75ec0756ed))
118
+ * revert vite build ([210ddea](https://github.com/zhangyuang/ssr/commit/210ddea22fc0639f60fcee96bdf47463d188e18f))
119
+ * update preinstall ([2b4b869](https://github.com/zhangyuang/ssr/commit/2b4b869c28b83b414bef10260e5561bc3773cea9))
120
+ * useStore types ([3532bfb](https://github.com/zhangyuang/ssr/commit/3532bfbef9981da300abf748a98925b59cc2c71d))
121
+ * vite build logic close [#221](https://github.com/zhangyuang/ssr/issues/221) ([297e2c0](https://github.com/zhangyuang/ssr/commit/297e2c0e5ad6609ce8cd3954a5886387f84343e6))
122
+ * vite mode config.base ([c64aa1a](https://github.com/zhangyuang/ssr/commit/c64aa1ab9d88cdfd7df1cce6feb43b191847e666))
123
+ * **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))
124
+ * vue3 package.json ([c49fb14](https://github.com/zhangyuang/ssr/commit/c49fb146fc6ba79ffbeee567e334b560ffecbcac))
125
+ * whitList concat userconfig ([fdd971a](https://github.com/zhangyuang/ssr/commit/fdd971ab11aebc0f348d789e758183b877e791af))
126
+ * whitList concat userconfig ([e2328f8](https://github.com/zhangyuang/ssr/commit/e2328f87f5cfc18c9a30867e4f6e18d0df5c1ba3))
127
+
128
+
129
+ ### Features
130
+
131
+ * optimize code remove disableClientRender fix vite ([eeff477](https://github.com/zhangyuang/ssr/commit/eeff4770f8d9ff400289cf4d1ca4dd32883be108))
132
+ * add .vue to defaultWhiteList ([dbabfa2](https://github.com/zhangyuang/ssr/commit/dbabfa2864ec0a5487aadc31286da5630a8603fc))
133
+ * add `turbo` ([#196](https://github.com/zhangyuang/ssr/issues/196)) ([2be17bb](https://github.com/zhangyuang/ssr/commit/2be17bba5d80610b97b3813b3d4fe9579f88e5c3))
134
+ * add parseRoutes watcher when files changed remove webpack-chain in ([a499654](https://github.com/zhangyuang/ssr/commit/a49965470e2b1e1d9744b59baede586bdd5fff90))
135
+ * add ssr-common-utils ([c12a283](https://github.com/zhangyuang/ssr/commit/c12a283e0133285402f4af5cd0346b84f2aaf098))
136
+ * add ssr-serialize-javascript code optimize ([41bb14d](https://github.com/zhangyuang/ssr/commit/41bb14d31efd89d4a85d5220544d2f7a3883e1a3))
137
+ * add useStore ([b786b8c](https://github.com/zhangyuang/ssr/commit/b786b8cc314ce9d45d56ac68c93020209643b208))
138
+ * add viteConfig.ssr.external ([2035967](https://github.com/zhangyuang/ssr/commit/2035967def8d2f9d48997d6994efd8ffbb4fd382))
139
+ * babelExtraModule support vue ([06251e7](https://github.com/zhangyuang/ssr/commit/06251e716678e1f882f06f68f72c518a341de0d7))
140
+ * babelExtraModule support vue ([513073d](https://github.com/zhangyuang/ssr/commit/513073ddcecbb728d34eae233686a93d63355e00))
141
+ * change splitChunks from all to initial ([f0de225](https://github.com/zhangyuang/ssr/commit/f0de22566ff7769b02d3b7d7b75bde12a5b2c28a))
142
+ * don't cover viteConfig.build ([02aef3b](https://github.com/zhangyuang/ssr/commit/02aef3b44c1cde54d8586f0d73defdcdc7ce0ad3))
143
+ * generate html file support inject prefix ([02741ee](https://github.com/zhangyuang/ssr/commit/02741eeda778eec26504c5e7e2c074b1d2402e83))
144
+ * move react-router to external ([0a58570](https://github.com/zhangyuang/ssr/commit/0a585705fb66d9f3a4a59008f1f3e82b23f05fae))
145
+ * optimize customescript ([f374760](https://github.com/zhangyuang/ssr/commit/f3747608d4684576875968394eca6315e2fa8dd1))
146
+ * plugin-midway remove luckyeye ([bb4b11f](https://github.com/zhangyuang/ssr/commit/bb4b11f289d060c8b332cf610bb6d8c4cf25142b))
147
+ * plugin-react add react-refresh, remove module.hot ([7bee211](https://github.com/zhangyuang/ssr/commit/7bee211ddfefaef688713f505756e1155320b844))
148
+ * remove plugin-nestjs deploy ([0ba16f8](https://github.com/zhangyuang/ssr/commit/0ba16f861b6dc679f216cbbcc931de75cdf79501))
149
+ * render add generic function overloading ([f03897f](https://github.com/zhangyuang/ssr/commit/f03897f07844d8fd5f9d2cf3eeef1a726da794bf))
150
+ * set argv.ssl for plugin-midway ([#213](https://github.com/zhangyuang/ssr/issues/213)) ([65c1cb9](https://github.com/zhangyuang/ssr/commit/65c1cb9da0772e915162dcd9b03fad2fada22b40))
151
+ * support htmlTemplate ([b240811](https://github.com/zhangyuang/ssr/commit/b2408114a6314ef4f96f4c06159d18fc6d881a57))
152
+ * support more vite config ([3ac5edc](https://github.com/zhangyuang/ssr/commit/3ac5edc605b59a1e1927fad0838cc730aba82b59))
153
+ * support props.ssrApp in vue3 ([8985037](https://github.com/zhangyuang/ssr/commit/898503753cbe69187d27f91c70dff3f4cd4a0b2a))
154
+ * support vite + wasm vite otherConfig ([7e65899](https://github.com/zhangyuang/ssr/commit/7e658998bc404c28374645c3a8a433a3db171f36))
155
+ * support vuex store options ([9bed529](https://github.com/zhangyuang/ssr/commit/9bed5299a59386e0cd70abbb8a66eca6090ed400))
156
+ * support wasm in webpack, lock postcss-preset-env version ([8ad50a4](https://github.com/zhangyuang/ssr/commit/8ad50a41227a8eb5395c955e5deeda7eb56036b0))
157
+ * support wildcare params ([c5cde18](https://github.com/zhangyuang/ssr/commit/c5cde18566365f9d3bbc81691c0ca5e7b72607d4))
158
+ * update chainBaseConfig ([51c1fbe](https://github.com/zhangyuang/ssr/commit/51c1fbe5a645d4701c7ebc035083096d50301891))
159
+ * update extraJsOrder extraCssOrder ([cd5ca99](https://github.com/zhangyuang/ssr/commit/cd5ca99a686ea565020500a6c4f77e310b422ce3))
160
+ * update fetch params ([70aedaa](https://github.com/zhangyuang/ssr/commit/70aedaa82a69552e22af1998bf1c2de8e30e0283))
161
+ * update midway deploy ([a473c59](https://github.com/zhangyuang/ssr/commit/a473c599657df42b4bf7a59f248b3c7c33907657))
162
+ * update plugin-vue3 support call pinia in fetch.ts ([958fdc7](https://github.com/zhangyuang/ssr/commit/958fdc787ab615593f3114a6bf2c6cea4823afc2))
163
+ * update ssr-common-utils ([c7cadc1](https://github.com/zhangyuang/ssr/commit/c7cadc14922383f8fdaa6c76b4dbe9c220d0ac72))
164
+ * update turbo ([9ee14f5](https://github.com/zhangyuang/ssr/commit/9ee14f59359187e35f4ef990998846ac3847347b))
165
+ * update vite config ([0596573](https://github.com/zhangyuang/ssr/commit/05965738898d96d53dedbd41746b8100dcc5653b))
166
+ * update vue example inject content for consistent ([c863c01](https://github.com/zhangyuang/ssr/commit/c863c011fc06ceed5d204d3d96eea29cf7c7d4b8))
167
+ * upgrade midway example to v3 ([572f7c5](https://github.com/zhangyuang/ssr/commit/572f7c5d171346cc17f5f6cdebe33aee76e0c146))
168
+ * 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))
169
+ * upgrade vue-router^2 to vue-router^3 ([283ed9e](https://github.com/zhangyuang/ssr/commit/283ed9ec4f6d8a622bcc3599ca33f9b0885ed3e5))
170
+ * use pnpm replace yarn workspace and lerna ([#186](https://github.com/zhangyuang/ssr/issues/186)) ([d578506](https://github.com/zhangyuang/ssr/commit/d578506160712847c1dd021b7759c7e9ff3c03e8))
171
+ * use ssr-vite-plugin-style-import ([1c8cac2](https://github.com/zhangyuang/ssr/commit/1c8cac2ff9bb7ec0132c23203efa5c85a8c7492e))
172
+ * use terser minify plugin-react server bundle ([0a3c7fe](https://github.com/zhangyuang/ssr/commit/0a3c7fe61908fe24bcb2d8c6394daf2afd18ba82))
173
+ * vite build extra vendor ([#210](https://github.com/zhangyuang/ssr/issues/210)) ([3eb6e4f](https://github.com/zhangyuang/ssr/commit/3eb6e4fde592a6ef59a7fd6790b56e38c187960d))
174
+ * vite build extra vendor and client-entry ([#211](https://github.com/zhangyuang/ssr/issues/211)) ([41fb1fe](https://github.com/zhangyuang/ssr/commit/41fb1fef04a1c954828d42e4dfe40445bcea444f))
175
+ * vite mode support splitChunk dynamic module ([4157fc2](https://github.com/zhangyuang/ssr/commit/4157fc24176b69c9815450b3623742995feae144))
176
+ * vue3 add default isCustomElement ([44ab37c](https://github.com/zhangyuang/ssr/commit/44ab37c27908b5927578d78a834d2404d42c70dd))
177
+ * vue3 support pinia, replace props.fetchData to props.reactiveFetchData in vue2/3 ([eabcb50](https://github.com/zhangyuang/ssr/commit/eabcb50729517b7cb649729d52356a06a010a8fc))
178
+ * webpack build optimize ([#222](https://github.com/zhangyuang/ssr/issues/222)) ([217dd38](https://github.com/zhangyuang/ssr/commit/217dd388c70d2a7d93d8eeec64a3d26136afe51b))
179
+
180
+
181
+
182
+ ## [6.2.27](https://github.com/zhangyuang/ssr/compare/v6.2.8...v6.2.27) (2022-07-04)
183
+
184
+
185
+ ### Bug Fixes
186
+
187
+ * add build:publish disable sourcemap ([ef82b29](https://github.com/zhangyuang/ssr/commit/ef82b298ddf19b72b130d76c33bfbca67339b139))
188
+ * 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))
189
+ * build html ([83be7be](https://github.com/zhangyuang/ssr/commit/83be7be185985a5dcbb9b8e846a5e2b14b94c1b0))
190
+ * build html ([59a8d7f](https://github.com/zhangyuang/ssr/commit/59a8d7f31bed703601e753d02db49ea5a0f93054))
191
+ * ci ([57e713f](https://github.com/zhangyuang/ssr/commit/57e713f1f96b4ceb893837c15c6032b23a0b1a4c))
192
+ * core-js types ([036bf38](https://github.com/zhangyuang/ssr/commit/036bf385d8ed804dfc2e46ef4484f7bf499d7cdb))
193
+ * don't throw error when load module failed ([2e5d077](https://github.com/zhangyuang/ssr/commit/2e5d077848dc10998a04fcccccc7c745c0d1bea7))
194
+ * fix config htmlTemplate read ([#191](https://github.com/zhangyuang/ssr/issues/191)) ([8c3e12b](https://github.com/zhangyuang/ssr/commit/8c3e12b6adb64b7898bc6232d980e72c5353026b))
195
+ * loadConfig ([8960c84](https://github.com/zhangyuang/ssr/commit/8960c84eea7b384d59ebfe6424813afec433b3f8))
196
+ * lock babel-plugin-import ([72c3041](https://github.com/zhangyuang/ssr/commit/72c3041bf61a1fc9b7593df1fdb6c4dc850c6bbd))
197
+ * lock vite version in plugin-react ([e015b75](https://github.com/zhangyuang/ssr/commit/e015b750c60dcae9a4a7e5fe14937177b80367ca))
198
+ * plugin-react without dynamic mode ([487cc84](https://github.com/zhangyuang/ssr/commit/487cc84188640aab13c27214df758da0d19e4368))
199
+ * postinstall ([fef24ba](https://github.com/zhangyuang/ssr/commit/fef24bada3498f162efd0bdd09921503e44ad21a))
200
+ * postinstall get correct path ([b3d1951](https://github.com/zhangyuang/ssr/commit/b3d1951b7537c5954fd040797fc0011a1d4439d7))
201
+ * react router basename in server entry ([#212](https://github.com/zhangyuang/ssr/issues/212)) ([28072f7](https://github.com/zhangyuang/ssr/commit/28072f7bdfc489a27599b636db33bdea18ef4c18))
202
+ * Recommended to specify used minor core-js version ([#207](https://github.com/zhangyuang/ssr/issues/207)) ([9db0424](https://github.com/zhangyuang/ssr/commit/9db0424e5e7ad1728d40665d01740f7a2c1c4b70))
203
+ * release utils ([1b9c56b](https://github.com/zhangyuang/ssr/commit/1b9c56bc904faa0cae39fb329c02b5d159d69872))
204
+ * restore webpack split chunks config ([2f7ae67](https://github.com/zhangyuang/ssr/commit/2f7ae67ecef863d56752a4a4e1fa7a75ec0756ed))
205
+ * revert vite build ([210ddea](https://github.com/zhangyuang/ssr/commit/210ddea22fc0639f60fcee96bdf47463d188e18f))
206
+ * update preinstall ([2b4b869](https://github.com/zhangyuang/ssr/commit/2b4b869c28b83b414bef10260e5561bc3773cea9))
207
+ * useStore types ([3532bfb](https://github.com/zhangyuang/ssr/commit/3532bfbef9981da300abf748a98925b59cc2c71d))
208
+ * vite mode config.base ([c64aa1a](https://github.com/zhangyuang/ssr/commit/c64aa1ab9d88cdfd7df1cce6feb43b191847e666))
209
+ * **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))
210
+ * vue3 package.json ([c49fb14](https://github.com/zhangyuang/ssr/commit/c49fb146fc6ba79ffbeee567e334b560ffecbcac))
211
+ * whitList concat userconfig ([fdd971a](https://github.com/zhangyuang/ssr/commit/fdd971ab11aebc0f348d789e758183b877e791af))
212
+ * whitList concat userconfig ([e2328f8](https://github.com/zhangyuang/ssr/commit/e2328f87f5cfc18c9a30867e4f6e18d0df5c1ba3))
213
+
214
+
215
+ ### Features
216
+
217
+ * optimize code remove disableClientRender fix vite ([eeff477](https://github.com/zhangyuang/ssr/commit/eeff4770f8d9ff400289cf4d1ca4dd32883be108))
218
+ * add .vue to defaultWhiteList ([dbabfa2](https://github.com/zhangyuang/ssr/commit/dbabfa2864ec0a5487aadc31286da5630a8603fc))
219
+ * add `turbo` ([#196](https://github.com/zhangyuang/ssr/issues/196)) ([2be17bb](https://github.com/zhangyuang/ssr/commit/2be17bba5d80610b97b3813b3d4fe9579f88e5c3))
220
+ * add parseRoutes watcher when files changed remove webpack-chain in ([a499654](https://github.com/zhangyuang/ssr/commit/a49965470e2b1e1d9744b59baede586bdd5fff90))
221
+ * add ssr-common-utils ([c12a283](https://github.com/zhangyuang/ssr/commit/c12a283e0133285402f4af5cd0346b84f2aaf098))
222
+ * add ssr-serialize-javascript code optimize ([41bb14d](https://github.com/zhangyuang/ssr/commit/41bb14d31efd89d4a85d5220544d2f7a3883e1a3))
223
+ * add useStore ([b786b8c](https://github.com/zhangyuang/ssr/commit/b786b8cc314ce9d45d56ac68c93020209643b208))
224
+ * add viteConfig.ssr.external ([2035967](https://github.com/zhangyuang/ssr/commit/2035967def8d2f9d48997d6994efd8ffbb4fd382))
225
+ * babelExtraModule support vue ([06251e7](https://github.com/zhangyuang/ssr/commit/06251e716678e1f882f06f68f72c518a341de0d7))
226
+ * babelExtraModule support vue ([513073d](https://github.com/zhangyuang/ssr/commit/513073ddcecbb728d34eae233686a93d63355e00))
227
+ * change splitChunks from all to initial ([f0de225](https://github.com/zhangyuang/ssr/commit/f0de22566ff7769b02d3b7d7b75bde12a5b2c28a))
228
+ * don't cover viteConfig.build ([02aef3b](https://github.com/zhangyuang/ssr/commit/02aef3b44c1cde54d8586f0d73defdcdc7ce0ad3))
229
+ * generate html file support inject prefix ([02741ee](https://github.com/zhangyuang/ssr/commit/02741eeda778eec26504c5e7e2c074b1d2402e83))
230
+ * move react-router to external ([0a58570](https://github.com/zhangyuang/ssr/commit/0a585705fb66d9f3a4a59008f1f3e82b23f05fae))
231
+ * optimize customescript ([f374760](https://github.com/zhangyuang/ssr/commit/f3747608d4684576875968394eca6315e2fa8dd1))
232
+ * plugin-midway remove luckyeye ([bb4b11f](https://github.com/zhangyuang/ssr/commit/bb4b11f289d060c8b332cf610bb6d8c4cf25142b))
233
+ * plugin-react add react-refresh, remove module.hot ([7bee211](https://github.com/zhangyuang/ssr/commit/7bee211ddfefaef688713f505756e1155320b844))
234
+ * remove plugin-nestjs deploy ([0ba16f8](https://github.com/zhangyuang/ssr/commit/0ba16f861b6dc679f216cbbcc931de75cdf79501))
235
+ * render add generic function overloading ([f03897f](https://github.com/zhangyuang/ssr/commit/f03897f07844d8fd5f9d2cf3eeef1a726da794bf))
236
+ * set argv.ssl for plugin-midway ([#213](https://github.com/zhangyuang/ssr/issues/213)) ([65c1cb9](https://github.com/zhangyuang/ssr/commit/65c1cb9da0772e915162dcd9b03fad2fada22b40))
237
+ * support htmlTemplate ([b240811](https://github.com/zhangyuang/ssr/commit/b2408114a6314ef4f96f4c06159d18fc6d881a57))
238
+ * support props.ssrApp in vue3 ([8985037](https://github.com/zhangyuang/ssr/commit/898503753cbe69187d27f91c70dff3f4cd4a0b2a))
239
+ * support vite + wasm vite otherConfig ([7e65899](https://github.com/zhangyuang/ssr/commit/7e658998bc404c28374645c3a8a433a3db171f36))
240
+ * support vuex store options ([9bed529](https://github.com/zhangyuang/ssr/commit/9bed5299a59386e0cd70abbb8a66eca6090ed400))
241
+ * support wasm in webpack, lock postcss-preset-env version ([8ad50a4](https://github.com/zhangyuang/ssr/commit/8ad50a41227a8eb5395c955e5deeda7eb56036b0))
242
+ * support wildcare params ([c5cde18](https://github.com/zhangyuang/ssr/commit/c5cde18566365f9d3bbc81691c0ca5e7b72607d4))
243
+ * update chainBaseConfig ([51c1fbe](https://github.com/zhangyuang/ssr/commit/51c1fbe5a645d4701c7ebc035083096d50301891))
244
+ * update extraJsOrder extraCssOrder ([cd5ca99](https://github.com/zhangyuang/ssr/commit/cd5ca99a686ea565020500a6c4f77e310b422ce3))
245
+ * update fetch params ([70aedaa](https://github.com/zhangyuang/ssr/commit/70aedaa82a69552e22af1998bf1c2de8e30e0283))
246
+ * update midway deploy ([a473c59](https://github.com/zhangyuang/ssr/commit/a473c599657df42b4bf7a59f248b3c7c33907657))
247
+ * update plugin-vue3 support call pinia in fetch.ts ([958fdc7](https://github.com/zhangyuang/ssr/commit/958fdc787ab615593f3114a6bf2c6cea4823afc2))
248
+ * update ssr-common-utils ([c7cadc1](https://github.com/zhangyuang/ssr/commit/c7cadc14922383f8fdaa6c76b4dbe9c220d0ac72))
249
+ * update turbo ([9ee14f5](https://github.com/zhangyuang/ssr/commit/9ee14f59359187e35f4ef990998846ac3847347b))
250
+ * update vite config ([0596573](https://github.com/zhangyuang/ssr/commit/05965738898d96d53dedbd41746b8100dcc5653b))
251
+ * upgrade midway example to v3 ([572f7c5](https://github.com/zhangyuang/ssr/commit/572f7c5d171346cc17f5f6cdebe33aee76e0c146))
252
+ * 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))
253
+ * upgrade vue-router^2 to vue-router^3 ([283ed9e](https://github.com/zhangyuang/ssr/commit/283ed9ec4f6d8a622bcc3599ca33f9b0885ed3e5))
254
+ * use pnpm replace yarn workspace and lerna ([#186](https://github.com/zhangyuang/ssr/issues/186)) ([d578506](https://github.com/zhangyuang/ssr/commit/d578506160712847c1dd021b7759c7e9ff3c03e8))
255
+ * use ssr-vite-plugin-style-import ([1c8cac2](https://github.com/zhangyuang/ssr/commit/1c8cac2ff9bb7ec0132c23203efa5c85a8c7492e))
256
+ * use terser minify plugin-react server bundle ([0a3c7fe](https://github.com/zhangyuang/ssr/commit/0a3c7fe61908fe24bcb2d8c6394daf2afd18ba82))
257
+ * vite build extra vendor ([#210](https://github.com/zhangyuang/ssr/issues/210)) ([3eb6e4f](https://github.com/zhangyuang/ssr/commit/3eb6e4fde592a6ef59a7fd6790b56e38c187960d))
258
+ * vite build extra vendor and client-entry ([#211](https://github.com/zhangyuang/ssr/issues/211)) ([41fb1fe](https://github.com/zhangyuang/ssr/commit/41fb1fef04a1c954828d42e4dfe40445bcea444f))
259
+ * vite mode support splitChunk dynamic module ([4157fc2](https://github.com/zhangyuang/ssr/commit/4157fc24176b69c9815450b3623742995feae144))
260
+ * vue3 add default isCustomElement ([44ab37c](https://github.com/zhangyuang/ssr/commit/44ab37c27908b5927578d78a834d2404d42c70dd))
261
+ * vue3 support pinia, replace props.fetchData to props.reactiveFetchData in vue2/3 ([eabcb50](https://github.com/zhangyuang/ssr/commit/eabcb50729517b7cb649729d52356a06a010a8fc))
262
+
263
+
264
+
1
265
  ## [6.2.26](https://github.com/zhangyuang/ssr/compare/v6.2.8...v6.2.26) (2022-06-22)
2
266
 
3
267
 
@@ -1,3 +1,4 @@
1
+ /// <reference types="webpack" />
1
2
  import * as WebpackChain from 'webpack-chain';
2
3
  declare const getClientWebpack: (chain: WebpackChain) => import("webpack").Configuration;
3
4
  export { getClientWebpack };
@@ -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,oCA8G5C,CAAA;AAED,OAAO,EACL,gBAAgB,EACjB,CAAA"}
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/config/client.ts"],"names":[],"mappings":";AAGA,OAAO,KAAK,YAAY,MAAM,eAAe,CAAA;AAe7C,QAAA,MAAM,gBAAgB,UAAW,YAAY,oCAgG5C,CAAA;AAED,OAAO,EACL,gBAAgB,EACjB,CAAA"}
@@ -11,9 +11,11 @@ const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPl
11
11
  const ReactRefreshWebpackPlugin = require('@pmmmwh/react-refresh-webpack-plugin');
12
12
  const generateAnalysis = Boolean(process.env.GENERATE_ANALYSIS);
13
13
  const loadModule = ssr_server_utils_1.loadModuleFromFramework;
14
- let asyncChunkMap = {};
14
+ const asyncChunkMap = {
15
+ val: {}
16
+ };
15
17
  const getClientWebpack = (chain) => {
16
- const { isDev, chunkName, getOutput, cwd, useHash, chainClientConfig, host, fePort } = (0, ssr_server_utils_1.loadConfig)();
18
+ const { isDev, chunkName, getOutput, cwd, useHash, chainClientConfig, host, fePort, optimize } = (0, ssr_server_utils_1.loadConfig)();
17
19
  const shouldUseSourceMap = isDev || Boolean(process.env.GENERATE_SOURCEMAP);
18
20
  const publicPath = (0, ssr_server_utils_1.getOutputPublicPath)();
19
21
  (0, base_1.getBaseConfig)(chain, false);
@@ -29,22 +31,7 @@ const getClientWebpack = (chain) => {
29
31
  .end();
30
32
  chain.optimization
31
33
  .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
- })
34
+ .splitChunks((0, ssr_server_utils_1.getSplitChunksOptions)(asyncChunkMap))
48
35
  .when(!isDev, optimization => {
49
36
  optimization.minimizer('terser')
50
37
  .use(loadModule('terser-webpack-plugin'), [{
@@ -100,12 +87,13 @@ const getClientWebpack = (chain) => {
100
87
  });
101
88
  chain.plugin('WriteAsyncManifest').use(class WriteAsyncChunkManifest {
102
89
  apply(compiler) {
103
- compiler.hooks.watchRun.tap('thisCompilation', async () => {
104
- // 每次构建前清空上一次的 chunk 信息
105
- asyncChunkMap = {};
90
+ compiler.hooks.watchRun.tap('ClearLastAsyncChunkMap', async () => {
91
+ asyncChunkMap.val = {};
106
92
  });
107
93
  compiler.hooks.done.tapAsync('WriteAsyncChunkManifest', async (params, callback) => {
108
- await fs_1.promises.writeFile((0, path_1.resolve)((0, ssr_server_utils_1.getCwd)(), './build/asyncChunkMap.json'), JSON.stringify(asyncChunkMap));
94
+ if (!optimize) {
95
+ await fs_1.promises.writeFile((0, path_1.resolve)((0, ssr_server_utils_1.getCwd)(), './build/asyncChunkMap.json'), JSON.stringify(asyncChunkMap.val));
96
+ }
109
97
  callback();
110
98
  });
111
99
  }
@@ -64,7 +64,7 @@ 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 && `window.clientPrefix="${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
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 } },
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,wBAAgB,YAAY;;;;EAsB3B;AAED,cAAc,cAAc,CAAA"}
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
  }
@@ -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
- export { viteBuild, viteStart, serverConfig, clientConfig };
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
@@ -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,UAwCnB,CAAA;AACD,QAAA,MAAM,YAAY,EAAE,UA+BnB,CAAA;AACD,QAAA,MAAM,SAAS,qBAEd,CAAA;AACD,QAAA,MAAM,SAAS,qBAGd,CAAA;AAED,OAAO,EACL,SAAS,EACT,SAAS,EACT,YAAY,EACZ,YAAY,EACb,CAAA"}
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
- keepNames: true
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
- ...(_j = viteConfig === null || viteConfig === void 0 ? void 0 : viteConfig().client) === null || _j === void 0 ? void 0 : _j.otherConfig,
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
- keepNames: true
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
- ...(_l = (_k = viteConfig === null || viteConfig === void 0 ? void 0 : viteConfig()) === null || _k === void 0 ? void 0 : _k.client) === null || _l === void 0 ? void 0 : _l.defaultPluginOptions,
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
- (_o = (_m = viteConfig === null || viteConfig === void 0 ? void 0 : viteConfig()) === null || _m === void 0 ? void 0 : _m.common) === null || _o === void 0 ? void 0 : _o.extraPlugin,
77
- (_q = (_p = viteConfig === null || viteConfig === void 0 ? void 0 : viteConfig()) === null || _p === void 0 ? void 0 : _p.client) === null || _q === void 0 ? void 0 : _q.extraPlugin,
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;
@@ -1,3 +1,4 @@
1
+ /// <reference types="webpack" />
1
2
  import * as WebpackChain from 'webpack-chain';
2
3
  declare const getClientWebpack: (chain: WebpackChain) => import("webpack").Configuration;
3
4
  export { getClientWebpack };
@@ -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,oCA8G5C,CAAA;AAED,OAAO,EACL,gBAAgB,EACjB,CAAA"}
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/config/client.ts"],"names":[],"mappings":";AAGA,OAAO,KAAK,YAAY,MAAM,eAAe,CAAA;AAe7C,QAAA,MAAM,gBAAgB,UAAW,YAAY,oCAgG5C,CAAA;AAED,OAAO,EACL,gBAAgB,EACjB,CAAA"}
@@ -1,6 +1,6 @@
1
1
  import { promises } from 'fs';
2
2
  import { resolve } from 'path';
3
- import { loadConfig, getCwd, cryptoAsyncChunkName, getOutputPublicPath, loadModuleFromFramework } from 'ssr-server-utils';
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');
@@ -8,9 +8,11 @@ const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPl
8
8
  const ReactRefreshWebpackPlugin = require('@pmmmwh/react-refresh-webpack-plugin');
9
9
  const generateAnalysis = Boolean(process.env.GENERATE_ANALYSIS);
10
10
  const loadModule = loadModuleFromFramework;
11
- let asyncChunkMap = {};
11
+ const asyncChunkMap = {
12
+ val: {}
13
+ };
12
14
  const getClientWebpack = (chain) => {
13
- const { isDev, chunkName, getOutput, cwd, useHash, chainClientConfig, host, fePort } = loadConfig();
15
+ const { isDev, chunkName, getOutput, cwd, useHash, chainClientConfig, host, fePort, optimize } = loadConfig();
14
16
  const shouldUseSourceMap = isDev || Boolean(process.env.GENERATE_SOURCEMAP);
15
17
  const publicPath = getOutputPublicPath();
16
18
  getBaseConfig(chain, false);
@@ -26,22 +28,7 @@ const getClientWebpack = (chain) => {
26
28
  .end();
27
29
  chain.optimization
28
30
  .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
- })
31
+ .splitChunks(getSplitChunksOptions(asyncChunkMap))
45
32
  .when(!isDev, optimization => {
46
33
  optimization.minimizer('terser')
47
34
  .use(loadModule('terser-webpack-plugin'), [{
@@ -97,12 +84,13 @@ const getClientWebpack = (chain) => {
97
84
  });
98
85
  chain.plugin('WriteAsyncManifest').use(class WriteAsyncChunkManifest {
99
86
  apply(compiler) {
100
- compiler.hooks.watchRun.tap('thisCompilation', async () => {
101
- // 每次构建前清空上一次的 chunk 信息
102
- asyncChunkMap = {};
87
+ compiler.hooks.watchRun.tap('ClearLastAsyncChunkMap', async () => {
88
+ asyncChunkMap.val = {};
103
89
  });
104
90
  compiler.hooks.done.tapAsync('WriteAsyncChunkManifest', async (params, callback) => {
105
- await promises.writeFile(resolve(getCwd(), './build/asyncChunkMap.json'), JSON.stringify(asyncChunkMap));
91
+ if (!optimize) {
92
+ await promises.writeFile(resolve(getCwd(), './build/asyncChunkMap.json'), JSON.stringify(asyncChunkMap.val));
93
+ }
106
94
  callback();
107
95
  });
108
96
  }
@@ -61,7 +61,7 @@ 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 && `window.clientPrefix="${clientPrefix}"`}`
64
+ __html: `window.__USE_SSR__=true; window.__INITIAL_DATA__ =${serialize(combineData)}; window.prefix="${prefix}";${clientPrefix ? `window.clientPrefix="${clientPrefix}";` : ''}`
65
65
  } });
66
66
  return (React.createElement(StaticRouter, { location: ctx.request.url, basename: prefix },
67
67
  React.createElement(Context.Provider, { value: { state: combineData } },
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,wBAAgB,YAAY;;;;EAsB3B;AAED,cAAc,cAAc,CAAA"}
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
  }
@@ -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
- export { viteBuild, viteStart, serverConfig, clientConfig };
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
@@ -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,UAwCnB,CAAA;AACD,QAAA,MAAM,YAAY,EAAE,UA+BnB,CAAA;AACD,QAAA,MAAM,SAAS,qBAEd,CAAA;AACD,QAAA,MAAM,SAAS,qBAGd,CAAA;AAED,OAAO,EACL,SAAS,EACT,SAAS,EACT,YAAY,EACZ,YAAY,EACb,CAAA"}
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
- keepNames: true
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
- ...(_j = viteConfig === null || viteConfig === void 0 ? void 0 : viteConfig().client) === null || _j === void 0 ? void 0 : _j.otherConfig,
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
- keepNames: true
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
- ...(_l = (_k = viteConfig === null || viteConfig === void 0 ? void 0 : viteConfig()) === null || _k === void 0 ? void 0 : _k.client) === null || _l === void 0 ? void 0 : _l.defaultPluginOptions,
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
- (_o = (_m = viteConfig === null || viteConfig === void 0 ? void 0 : viteConfig()) === null || _m === void 0 ? void 0 : _m.common) === null || _o === void 0 ? void 0 : _o.extraPlugin,
73
- (_q = (_p = viteConfig === null || viteConfig === void 0 ? void 0 : viteConfig()) === null || _p === void 0 ? void 0 : _p.client) === null || _q === void 0 ? void 0 : _q.extraPlugin,
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
- export { viteBuild, viteStart, serverConfig, clientConfig };
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.26",
3
+ "version": "6.2.29",
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.7.0",
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",
@@ -1,7 +1,8 @@
1
1
  import { promises } from 'fs'
2
2
  import { resolve } from 'path'
3
- import { loadConfig, getCwd, cryptoAsyncChunkName, getOutputPublicPath, loadModuleFromFramework } from 'ssr-server-utils'
3
+ import { loadConfig, getCwd, getSplitChunksOptions, getOutputPublicPath, loadModuleFromFramework } from 'ssr-server-utils'
4
4
  import * as WebpackChain from 'webpack-chain'
5
+ import { Compiler } from 'webpack'
5
6
  import { getBaseConfig } from './base'
6
7
 
7
8
  const ModuleNotFoundPlugin = require('react-dev-utils/ModuleNotFoundPlugin')
@@ -10,10 +11,13 @@ const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPl
10
11
  const ReactRefreshWebpackPlugin = require('@pmmmwh/react-refresh-webpack-plugin')
11
12
  const generateAnalysis = Boolean(process.env.GENERATE_ANALYSIS)
12
13
  const loadModule = loadModuleFromFramework
13
- let asyncChunkMap: Record<string, string[]> = {}
14
-
14
+ const asyncChunkMap: {
15
+ val: Record<string, string[]>
16
+ } = {
17
+ val: {}
18
+ }
15
19
  const getClientWebpack = (chain: WebpackChain) => {
16
- const { isDev, chunkName, getOutput, cwd, useHash, chainClientConfig, host, fePort } = loadConfig()
20
+ const { isDev, chunkName, getOutput, cwd, useHash, chainClientConfig, host, fePort, optimize } = loadConfig()
17
21
  const shouldUseSourceMap = isDev || Boolean(process.env.GENERATE_SOURCEMAP)
18
22
  const publicPath = getOutputPublicPath()
19
23
  getBaseConfig(chain, false)
@@ -29,22 +33,7 @@ const getClientWebpack = (chain: WebpackChain) => {
29
33
  .end()
30
34
  chain.optimization
31
35
  .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
- })
36
+ .splitChunks(getSplitChunksOptions(asyncChunkMap))
48
37
  .when(!isDev, optimization => {
49
38
  optimization.minimizer('terser')
50
39
  .use(loadModule('terser-webpack-plugin'), [{
@@ -104,15 +93,16 @@ const getClientWebpack = (chain: WebpackChain) => {
104
93
 
105
94
  chain.plugin('WriteAsyncManifest').use(
106
95
  class WriteAsyncChunkManifest {
107
- apply (compiler: any) {
108
- compiler.hooks.watchRun.tap('thisCompilation', async () => {
109
- // 每次构建前清空上一次的 chunk 信息
110
- asyncChunkMap = {}
96
+ apply (compiler: Compiler) {
97
+ compiler.hooks.watchRun.tap('ClearLastAsyncChunkMap', async () => {
98
+ asyncChunkMap.val = {}
111
99
  })
112
100
  compiler.hooks.done.tapAsync(
113
101
  'WriteAsyncChunkManifest',
114
102
  async (params: any, callback: any) => {
115
- await promises.writeFile(resolve(getCwd(), './build/asyncChunkMap.json'), JSON.stringify(asyncChunkMap))
103
+ if (!optimize) {
104
+ await promises.writeFile(resolve(getCwd(), './build/asyncChunkMap.json'), JSON.stringify(asyncChunkMap.val))
105
+ }
116
106
  callback()
117
107
  }
118
108
  )
@@ -69,7 +69,7 @@ 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 && `window.clientPrefix="${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 (
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
- keepNames: true
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
- keepNames: true
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
  }