ssr-plugin-react 6.2.27 → 6.2.30

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,278 @@
1
+ ## [6.2.30](https://github.com/zhangyuang/ssr/compare/v6.2.8...v6.2.30) (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
+ * don't write file to dist in webpack optimize ([c1cbce9](https://github.com/zhangyuang/ssr/commit/c1cbce927716dfa4fca052b1d54448e87771b1f6))
56
+ * generate html file support inject prefix ([02741ee](https://github.com/zhangyuang/ssr/commit/02741eeda778eec26504c5e7e2c074b1d2402e83))
57
+ * move react-router to external ([0a58570](https://github.com/zhangyuang/ssr/commit/0a585705fb66d9f3a4a59008f1f3e82b23f05fae))
58
+ * optimize customescript ([f374760](https://github.com/zhangyuang/ssr/commit/f3747608d4684576875968394eca6315e2fa8dd1))
59
+ * plugin-midway remove luckyeye ([bb4b11f](https://github.com/zhangyuang/ssr/commit/bb4b11f289d060c8b332cf610bb6d8c4cf25142b))
60
+ * plugin-react add react-refresh, remove module.hot ([7bee211](https://github.com/zhangyuang/ssr/commit/7bee211ddfefaef688713f505756e1155320b844))
61
+ * remove plugin-nestjs deploy ([0ba16f8](https://github.com/zhangyuang/ssr/commit/0ba16f861b6dc679f216cbbcc931de75cdf79501))
62
+ * render add generic function overloading ([f03897f](https://github.com/zhangyuang/ssr/commit/f03897f07844d8fd5f9d2cf3eeef1a726da794bf))
63
+ * set argv.ssl for plugin-midway ([#213](https://github.com/zhangyuang/ssr/issues/213)) ([65c1cb9](https://github.com/zhangyuang/ssr/commit/65c1cb9da0772e915162dcd9b03fad2fada22b40))
64
+ * support htmlTemplate ([b240811](https://github.com/zhangyuang/ssr/commit/b2408114a6314ef4f96f4c06159d18fc6d881a57))
65
+ * support more vite config ([3ac5edc](https://github.com/zhangyuang/ssr/commit/3ac5edc605b59a1e1927fad0838cc730aba82b59))
66
+ * support props.ssrApp in vue3 ([8985037](https://github.com/zhangyuang/ssr/commit/898503753cbe69187d27f91c70dff3f4cd4a0b2a))
67
+ * support vite + wasm vite otherConfig ([7e65899](https://github.com/zhangyuang/ssr/commit/7e658998bc404c28374645c3a8a433a3db171f36))
68
+ * support vuex store options ([9bed529](https://github.com/zhangyuang/ssr/commit/9bed5299a59386e0cd70abbb8a66eca6090ed400))
69
+ * support wasm in webpack, lock postcss-preset-env version ([8ad50a4](https://github.com/zhangyuang/ssr/commit/8ad50a41227a8eb5395c955e5deeda7eb56036b0))
70
+ * support wildcare params ([c5cde18](https://github.com/zhangyuang/ssr/commit/c5cde18566365f9d3bbc81691c0ca5e7b72607d4))
71
+ * update chainBaseConfig ([51c1fbe](https://github.com/zhangyuang/ssr/commit/51c1fbe5a645d4701c7ebc035083096d50301891))
72
+ * update extraJsOrder extraCssOrder ([cd5ca99](https://github.com/zhangyuang/ssr/commit/cd5ca99a686ea565020500a6c4f77e310b422ce3))
73
+ * update fetch params ([70aedaa](https://github.com/zhangyuang/ssr/commit/70aedaa82a69552e22af1998bf1c2de8e30e0283))
74
+ * update midway deploy ([a473c59](https://github.com/zhangyuang/ssr/commit/a473c599657df42b4bf7a59f248b3c7c33907657))
75
+ * update plugin-vue3 support call pinia in fetch.ts ([958fdc7](https://github.com/zhangyuang/ssr/commit/958fdc787ab615593f3114a6bf2c6cea4823afc2))
76
+ * update ssr-common-utils ([c7cadc1](https://github.com/zhangyuang/ssr/commit/c7cadc14922383f8fdaa6c76b4dbe9c220d0ac72))
77
+ * update turbo ([9ee14f5](https://github.com/zhangyuang/ssr/commit/9ee14f59359187e35f4ef990998846ac3847347b))
78
+ * update vite config ([0596573](https://github.com/zhangyuang/ssr/commit/05965738898d96d53dedbd41746b8100dcc5653b))
79
+ * update vue example inject content for consistent ([c863c01](https://github.com/zhangyuang/ssr/commit/c863c011fc06ceed5d204d3d96eea29cf7c7d4b8))
80
+ * upgrade midway example to v3 ([572f7c5](https://github.com/zhangyuang/ssr/commit/572f7c5d171346cc17f5f6cdebe33aee76e0c146))
81
+ * 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))
82
+ * upgrade vue-router^2 to vue-router^3 ([283ed9e](https://github.com/zhangyuang/ssr/commit/283ed9ec4f6d8a622bcc3599ca33f9b0885ed3e5))
83
+ * use pnpm replace yarn workspace and lerna ([#186](https://github.com/zhangyuang/ssr/issues/186)) ([d578506](https://github.com/zhangyuang/ssr/commit/d578506160712847c1dd021b7759c7e9ff3c03e8))
84
+ * use ssr-vite-plugin-style-import ([1c8cac2](https://github.com/zhangyuang/ssr/commit/1c8cac2ff9bb7ec0132c23203efa5c85a8c7492e))
85
+ * use terser minify plugin-react server bundle ([0a3c7fe](https://github.com/zhangyuang/ssr/commit/0a3c7fe61908fe24bcb2d8c6394daf2afd18ba82))
86
+ * vite build extra vendor ([#210](https://github.com/zhangyuang/ssr/issues/210)) ([3eb6e4f](https://github.com/zhangyuang/ssr/commit/3eb6e4fde592a6ef59a7fd6790b56e38c187960d))
87
+ * vite build extra vendor and client-entry ([#211](https://github.com/zhangyuang/ssr/issues/211)) ([41fb1fe](https://github.com/zhangyuang/ssr/commit/41fb1fef04a1c954828d42e4dfe40445bcea444f))
88
+ * vite mode support splitChunk dynamic module ([4157fc2](https://github.com/zhangyuang/ssr/commit/4157fc24176b69c9815450b3623742995feae144))
89
+ * vue3 add default isCustomElement ([44ab37c](https://github.com/zhangyuang/ssr/commit/44ab37c27908b5927578d78a834d2404d42c70dd))
90
+ * vue3 support pinia, replace props.fetchData to props.reactiveFetchData in vue2/3 ([eabcb50](https://github.com/zhangyuang/ssr/commit/eabcb50729517b7cb649729d52356a06a010a8fc))
91
+ * webpack build optimize ([#222](https://github.com/zhangyuang/ssr/issues/222)) ([217dd38](https://github.com/zhangyuang/ssr/commit/217dd388c70d2a7d93d8eeec64a3d26136afe51b))
92
+
93
+
94
+
95
+ ## [6.2.29](https://github.com/zhangyuang/ssr/compare/v6.2.8...v6.2.29) (2022-07-12)
96
+
97
+
98
+ ### Bug Fixes
99
+
100
+ * add build:publish disable sourcemap ([ef82b29](https://github.com/zhangyuang/ssr/commit/ef82b298ddf19b72b130d76c33bfbca67339b139))
101
+ * add checkContains ([6cae390](https://github.com/zhangyuang/ssr/commit/6cae390785e9f0c7aeb1574322a840a7569a6f8e))
102
+ * 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))
103
+ * add watchCount ([de1cef1](https://github.com/zhangyuang/ssr/commit/de1cef1db9193bdbbc5a4ec330e04ebcb29dd25a))
104
+ * build html ([83be7be](https://github.com/zhangyuang/ssr/commit/83be7be185985a5dcbb9b8e846a5e2b14b94c1b0))
105
+ * build html ([59a8d7f](https://github.com/zhangyuang/ssr/commit/59a8d7f31bed703601e753d02db49ea5a0f93054))
106
+ * ci ([57e713f](https://github.com/zhangyuang/ssr/commit/57e713f1f96b4ceb893837c15c6032b23a0b1a4c))
107
+ * clearlastAsyncChunkMap ([81a605d](https://github.com/zhangyuang/ssr/commit/81a605d79786609c063cba62aeec971cc38ffe17))
108
+ * core-js types ([036bf38](https://github.com/zhangyuang/ssr/commit/036bf385d8ed804dfc2e46ef4484f7bf499d7cdb))
109
+ * don't throw error when load module failed ([2e5d077](https://github.com/zhangyuang/ssr/commit/2e5d077848dc10998a04fcccccc7c745c0d1bea7))
110
+ * fetch data after use pinia ([3d1a3f4](https://github.com/zhangyuang/ssr/commit/3d1a3f41d6f5c001c4e233aba25608147fdae2a2))
111
+ * fix config htmlTemplate read ([#191](https://github.com/zhangyuang/ssr/issues/191)) ([8c3e12b](https://github.com/zhangyuang/ssr/commit/8c3e12b6adb64b7898bc6232d980e72c5353026b))
112
+ * loadConfig ([8960c84](https://github.com/zhangyuang/ssr/commit/8960c84eea7b384d59ebfe6424813afec433b3f8))
113
+ * lock babel-plugin-import ([72c3041](https://github.com/zhangyuang/ssr/commit/72c3041bf61a1fc9b7593df1fdb6c4dc850c6bbd))
114
+ * lock vite version in plugin-react ([e015b75](https://github.com/zhangyuang/ssr/commit/e015b750c60dcae9a4a7e5fe14937177b80367ca))
115
+ * plugin-react without dynamic mode ([487cc84](https://github.com/zhangyuang/ssr/commit/487cc84188640aab13c27214df758da0d19e4368))
116
+ * postinstall ([fef24ba](https://github.com/zhangyuang/ssr/commit/fef24bada3498f162efd0bdd09921503e44ad21a))
117
+ * postinstall get correct path ([b3d1951](https://github.com/zhangyuang/ssr/commit/b3d1951b7537c5954fd040797fc0011a1d4439d7))
118
+ * react router basename in server entry ([#212](https://github.com/zhangyuang/ssr/issues/212)) ([28072f7](https://github.com/zhangyuang/ssr/commit/28072f7bdfc489a27599b636db33bdea18ef4c18))
119
+ * Recommended to specify used minor core-js version ([#207](https://github.com/zhangyuang/ssr/issues/207)) ([9db0424](https://github.com/zhangyuang/ssr/commit/9db0424e5e7ad1728d40665d01740f7a2c1c4b70))
120
+ * release utils ([1b9c56b](https://github.com/zhangyuang/ssr/commit/1b9c56bc904faa0cae39fb329c02b5d159d69872))
121
+ * restore webpack split chunks config ([2f7ae67](https://github.com/zhangyuang/ssr/commit/2f7ae67ecef863d56752a4a4e1fa7a75ec0756ed))
122
+ * revert vite build ([210ddea](https://github.com/zhangyuang/ssr/commit/210ddea22fc0639f60fcee96bdf47463d188e18f))
123
+ * update preinstall ([2b4b869](https://github.com/zhangyuang/ssr/commit/2b4b869c28b83b414bef10260e5561bc3773cea9))
124
+ * useStore types ([3532bfb](https://github.com/zhangyuang/ssr/commit/3532bfbef9981da300abf748a98925b59cc2c71d))
125
+ * vite build logic close [#221](https://github.com/zhangyuang/ssr/issues/221) ([297e2c0](https://github.com/zhangyuang/ssr/commit/297e2c0e5ad6609ce8cd3954a5886387f84343e6))
126
+ * vite mode config.base ([c64aa1a](https://github.com/zhangyuang/ssr/commit/c64aa1ab9d88cdfd7df1cce6feb43b191847e666))
127
+ * **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))
128
+ * void chunk logic ([ad694a1](https://github.com/zhangyuang/ssr/commit/ad694a1275f12560360f4e73c3466cce39b3e878))
129
+ * vue3 package.json ([c49fb14](https://github.com/zhangyuang/ssr/commit/c49fb146fc6ba79ffbeee567e334b560ffecbcac))
130
+ * whitList concat userconfig ([fdd971a](https://github.com/zhangyuang/ssr/commit/fdd971ab11aebc0f348d789e758183b877e791af))
131
+ * whitList concat userconfig ([e2328f8](https://github.com/zhangyuang/ssr/commit/e2328f87f5cfc18c9a30867e4f6e18d0df5c1ba3))
132
+
133
+
134
+ ### Features
135
+
136
+ * optimize code remove disableClientRender fix vite ([eeff477](https://github.com/zhangyuang/ssr/commit/eeff4770f8d9ff400289cf4d1ca4dd32883be108))
137
+ * add .vue to defaultWhiteList ([dbabfa2](https://github.com/zhangyuang/ssr/commit/dbabfa2864ec0a5487aadc31286da5630a8603fc))
138
+ * add `turbo` ([#196](https://github.com/zhangyuang/ssr/issues/196)) ([2be17bb](https://github.com/zhangyuang/ssr/commit/2be17bba5d80610b97b3813b3d4fe9579f88e5c3))
139
+ * add parseRoutes watcher when files changed remove webpack-chain in ([a499654](https://github.com/zhangyuang/ssr/commit/a49965470e2b1e1d9744b59baede586bdd5fff90))
140
+ * add ssr-common-utils ([c12a283](https://github.com/zhangyuang/ssr/commit/c12a283e0133285402f4af5cd0346b84f2aaf098))
141
+ * add ssr-serialize-javascript code optimize ([41bb14d](https://github.com/zhangyuang/ssr/commit/41bb14d31efd89d4a85d5220544d2f7a3883e1a3))
142
+ * add useStore ([b786b8c](https://github.com/zhangyuang/ssr/commit/b786b8cc314ce9d45d56ac68c93020209643b208))
143
+ * add viteConfig.ssr.external ([2035967](https://github.com/zhangyuang/ssr/commit/2035967def8d2f9d48997d6994efd8ffbb4fd382))
144
+ * babelExtraModule support vue ([06251e7](https://github.com/zhangyuang/ssr/commit/06251e716678e1f882f06f68f72c518a341de0d7))
145
+ * babelExtraModule support vue ([513073d](https://github.com/zhangyuang/ssr/commit/513073ddcecbb728d34eae233686a93d63355e00))
146
+ * change splitChunks from all to initial ([f0de225](https://github.com/zhangyuang/ssr/commit/f0de22566ff7769b02d3b7d7b75bde12a5b2c28a))
147
+ * don't cover viteConfig.build ([02aef3b](https://github.com/zhangyuang/ssr/commit/02aef3b44c1cde54d8586f0d73defdcdc7ce0ad3))
148
+ * don't emit void chunk ([dc5d8b7](https://github.com/zhangyuang/ssr/commit/dc5d8b742a9f97f2be38d9da633b9d1768b6710b))
149
+ * generate html file support inject prefix ([02741ee](https://github.com/zhangyuang/ssr/commit/02741eeda778eec26504c5e7e2c074b1d2402e83))
150
+ * move react-router to external ([0a58570](https://github.com/zhangyuang/ssr/commit/0a585705fb66d9f3a4a59008f1f3e82b23f05fae))
151
+ * optimize customescript ([f374760](https://github.com/zhangyuang/ssr/commit/f3747608d4684576875968394eca6315e2fa8dd1))
152
+ * plugin-midway remove luckyeye ([bb4b11f](https://github.com/zhangyuang/ssr/commit/bb4b11f289d060c8b332cf610bb6d8c4cf25142b))
153
+ * plugin-react add react-refresh, remove module.hot ([7bee211](https://github.com/zhangyuang/ssr/commit/7bee211ddfefaef688713f505756e1155320b844))
154
+ * remove plugin-nestjs deploy ([0ba16f8](https://github.com/zhangyuang/ssr/commit/0ba16f861b6dc679f216cbbcc931de75cdf79501))
155
+ * render add generic function overloading ([f03897f](https://github.com/zhangyuang/ssr/commit/f03897f07844d8fd5f9d2cf3eeef1a726da794bf))
156
+ * set argv.ssl for plugin-midway ([#213](https://github.com/zhangyuang/ssr/issues/213)) ([65c1cb9](https://github.com/zhangyuang/ssr/commit/65c1cb9da0772e915162dcd9b03fad2fada22b40))
157
+ * support htmlTemplate ([b240811](https://github.com/zhangyuang/ssr/commit/b2408114a6314ef4f96f4c06159d18fc6d881a57))
158
+ * support more vite config ([3ac5edc](https://github.com/zhangyuang/ssr/commit/3ac5edc605b59a1e1927fad0838cc730aba82b59))
159
+ * support props.ssrApp in vue3 ([8985037](https://github.com/zhangyuang/ssr/commit/898503753cbe69187d27f91c70dff3f4cd4a0b2a))
160
+ * support vite + wasm vite otherConfig ([7e65899](https://github.com/zhangyuang/ssr/commit/7e658998bc404c28374645c3a8a433a3db171f36))
161
+ * support vuex store options ([9bed529](https://github.com/zhangyuang/ssr/commit/9bed5299a59386e0cd70abbb8a66eca6090ed400))
162
+ * support wasm in webpack, lock postcss-preset-env version ([8ad50a4](https://github.com/zhangyuang/ssr/commit/8ad50a41227a8eb5395c955e5deeda7eb56036b0))
163
+ * support wildcare params ([c5cde18](https://github.com/zhangyuang/ssr/commit/c5cde18566365f9d3bbc81691c0ca5e7b72607d4))
164
+ * update chainBaseConfig ([51c1fbe](https://github.com/zhangyuang/ssr/commit/51c1fbe5a645d4701c7ebc035083096d50301891))
165
+ * update extraJsOrder extraCssOrder ([cd5ca99](https://github.com/zhangyuang/ssr/commit/cd5ca99a686ea565020500a6c4f77e310b422ce3))
166
+ * update fetch params ([70aedaa](https://github.com/zhangyuang/ssr/commit/70aedaa82a69552e22af1998bf1c2de8e30e0283))
167
+ * update midway deploy ([a473c59](https://github.com/zhangyuang/ssr/commit/a473c599657df42b4bf7a59f248b3c7c33907657))
168
+ * update plugin-vue3 support call pinia in fetch.ts ([958fdc7](https://github.com/zhangyuang/ssr/commit/958fdc787ab615593f3114a6bf2c6cea4823afc2))
169
+ * update ssr-common-utils ([c7cadc1](https://github.com/zhangyuang/ssr/commit/c7cadc14922383f8fdaa6c76b4dbe9c220d0ac72))
170
+ * update turbo ([9ee14f5](https://github.com/zhangyuang/ssr/commit/9ee14f59359187e35f4ef990998846ac3847347b))
171
+ * update vite config ([0596573](https://github.com/zhangyuang/ssr/commit/05965738898d96d53dedbd41746b8100dcc5653b))
172
+ * update vue example inject content for consistent ([c863c01](https://github.com/zhangyuang/ssr/commit/c863c011fc06ceed5d204d3d96eea29cf7c7d4b8))
173
+ * upgrade midway example to v3 ([572f7c5](https://github.com/zhangyuang/ssr/commit/572f7c5d171346cc17f5f6cdebe33aee76e0c146))
174
+ * 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))
175
+ * upgrade vue-router^2 to vue-router^3 ([283ed9e](https://github.com/zhangyuang/ssr/commit/283ed9ec4f6d8a622bcc3599ca33f9b0885ed3e5))
176
+ * use pnpm replace yarn workspace and lerna ([#186](https://github.com/zhangyuang/ssr/issues/186)) ([d578506](https://github.com/zhangyuang/ssr/commit/d578506160712847c1dd021b7759c7e9ff3c03e8))
177
+ * use ssr-vite-plugin-style-import ([1c8cac2](https://github.com/zhangyuang/ssr/commit/1c8cac2ff9bb7ec0132c23203efa5c85a8c7492e))
178
+ * use terser minify plugin-react server bundle ([0a3c7fe](https://github.com/zhangyuang/ssr/commit/0a3c7fe61908fe24bcb2d8c6394daf2afd18ba82))
179
+ * vite build extra vendor ([#210](https://github.com/zhangyuang/ssr/issues/210)) ([3eb6e4f](https://github.com/zhangyuang/ssr/commit/3eb6e4fde592a6ef59a7fd6790b56e38c187960d))
180
+ * vite build extra vendor and client-entry ([#211](https://github.com/zhangyuang/ssr/issues/211)) ([41fb1fe](https://github.com/zhangyuang/ssr/commit/41fb1fef04a1c954828d42e4dfe40445bcea444f))
181
+ * vite mode support splitChunk dynamic module ([4157fc2](https://github.com/zhangyuang/ssr/commit/4157fc24176b69c9815450b3623742995feae144))
182
+ * vue3 add default isCustomElement ([44ab37c](https://github.com/zhangyuang/ssr/commit/44ab37c27908b5927578d78a834d2404d42c70dd))
183
+ * vue3 support pinia, replace props.fetchData to props.reactiveFetchData in vue2/3 ([eabcb50](https://github.com/zhangyuang/ssr/commit/eabcb50729517b7cb649729d52356a06a010a8fc))
184
+ * webpack build optimize ([#222](https://github.com/zhangyuang/ssr/issues/222)) ([217dd38](https://github.com/zhangyuang/ssr/commit/217dd388c70d2a7d93d8eeec64a3d26136afe51b))
185
+
186
+
187
+
188
+ ## [6.2.28](https://github.com/zhangyuang/ssr/compare/v6.2.8...v6.2.28) (2022-07-11)
189
+
190
+
191
+ ### Bug Fixes
192
+
193
+ * add build:publish disable sourcemap ([ef82b29](https://github.com/zhangyuang/ssr/commit/ef82b298ddf19b72b130d76c33bfbca67339b139))
194
+ * 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))
195
+ * build html ([83be7be](https://github.com/zhangyuang/ssr/commit/83be7be185985a5dcbb9b8e846a5e2b14b94c1b0))
196
+ * build html ([59a8d7f](https://github.com/zhangyuang/ssr/commit/59a8d7f31bed703601e753d02db49ea5a0f93054))
197
+ * ci ([57e713f](https://github.com/zhangyuang/ssr/commit/57e713f1f96b4ceb893837c15c6032b23a0b1a4c))
198
+ * core-js types ([036bf38](https://github.com/zhangyuang/ssr/commit/036bf385d8ed804dfc2e46ef4484f7bf499d7cdb))
199
+ * don't throw error when load module failed ([2e5d077](https://github.com/zhangyuang/ssr/commit/2e5d077848dc10998a04fcccccc7c745c0d1bea7))
200
+ * fetch data after use pinia ([3d1a3f4](https://github.com/zhangyuang/ssr/commit/3d1a3f41d6f5c001c4e233aba25608147fdae2a2))
201
+ * fix config htmlTemplate read ([#191](https://github.com/zhangyuang/ssr/issues/191)) ([8c3e12b](https://github.com/zhangyuang/ssr/commit/8c3e12b6adb64b7898bc6232d980e72c5353026b))
202
+ * loadConfig ([8960c84](https://github.com/zhangyuang/ssr/commit/8960c84eea7b384d59ebfe6424813afec433b3f8))
203
+ * lock babel-plugin-import ([72c3041](https://github.com/zhangyuang/ssr/commit/72c3041bf61a1fc9b7593df1fdb6c4dc850c6bbd))
204
+ * lock vite version in plugin-react ([e015b75](https://github.com/zhangyuang/ssr/commit/e015b750c60dcae9a4a7e5fe14937177b80367ca))
205
+ * plugin-react without dynamic mode ([487cc84](https://github.com/zhangyuang/ssr/commit/487cc84188640aab13c27214df758da0d19e4368))
206
+ * postinstall ([fef24ba](https://github.com/zhangyuang/ssr/commit/fef24bada3498f162efd0bdd09921503e44ad21a))
207
+ * postinstall get correct path ([b3d1951](https://github.com/zhangyuang/ssr/commit/b3d1951b7537c5954fd040797fc0011a1d4439d7))
208
+ * react router basename in server entry ([#212](https://github.com/zhangyuang/ssr/issues/212)) ([28072f7](https://github.com/zhangyuang/ssr/commit/28072f7bdfc489a27599b636db33bdea18ef4c18))
209
+ * Recommended to specify used minor core-js version ([#207](https://github.com/zhangyuang/ssr/issues/207)) ([9db0424](https://github.com/zhangyuang/ssr/commit/9db0424e5e7ad1728d40665d01740f7a2c1c4b70))
210
+ * release utils ([1b9c56b](https://github.com/zhangyuang/ssr/commit/1b9c56bc904faa0cae39fb329c02b5d159d69872))
211
+ * restore webpack split chunks config ([2f7ae67](https://github.com/zhangyuang/ssr/commit/2f7ae67ecef863d56752a4a4e1fa7a75ec0756ed))
212
+ * revert vite build ([210ddea](https://github.com/zhangyuang/ssr/commit/210ddea22fc0639f60fcee96bdf47463d188e18f))
213
+ * update preinstall ([2b4b869](https://github.com/zhangyuang/ssr/commit/2b4b869c28b83b414bef10260e5561bc3773cea9))
214
+ * useStore types ([3532bfb](https://github.com/zhangyuang/ssr/commit/3532bfbef9981da300abf748a98925b59cc2c71d))
215
+ * vite build logic close [#221](https://github.com/zhangyuang/ssr/issues/221) ([297e2c0](https://github.com/zhangyuang/ssr/commit/297e2c0e5ad6609ce8cd3954a5886387f84343e6))
216
+ * vite mode config.base ([c64aa1a](https://github.com/zhangyuang/ssr/commit/c64aa1ab9d88cdfd7df1cce6feb43b191847e666))
217
+ * **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))
218
+ * vue3 package.json ([c49fb14](https://github.com/zhangyuang/ssr/commit/c49fb146fc6ba79ffbeee567e334b560ffecbcac))
219
+ * whitList concat userconfig ([fdd971a](https://github.com/zhangyuang/ssr/commit/fdd971ab11aebc0f348d789e758183b877e791af))
220
+ * whitList concat userconfig ([e2328f8](https://github.com/zhangyuang/ssr/commit/e2328f87f5cfc18c9a30867e4f6e18d0df5c1ba3))
221
+
222
+
223
+ ### Features
224
+
225
+ * optimize code remove disableClientRender fix vite ([eeff477](https://github.com/zhangyuang/ssr/commit/eeff4770f8d9ff400289cf4d1ca4dd32883be108))
226
+ * add .vue to defaultWhiteList ([dbabfa2](https://github.com/zhangyuang/ssr/commit/dbabfa2864ec0a5487aadc31286da5630a8603fc))
227
+ * add `turbo` ([#196](https://github.com/zhangyuang/ssr/issues/196)) ([2be17bb](https://github.com/zhangyuang/ssr/commit/2be17bba5d80610b97b3813b3d4fe9579f88e5c3))
228
+ * add parseRoutes watcher when files changed remove webpack-chain in ([a499654](https://github.com/zhangyuang/ssr/commit/a49965470e2b1e1d9744b59baede586bdd5fff90))
229
+ * add ssr-common-utils ([c12a283](https://github.com/zhangyuang/ssr/commit/c12a283e0133285402f4af5cd0346b84f2aaf098))
230
+ * add ssr-serialize-javascript code optimize ([41bb14d](https://github.com/zhangyuang/ssr/commit/41bb14d31efd89d4a85d5220544d2f7a3883e1a3))
231
+ * add useStore ([b786b8c](https://github.com/zhangyuang/ssr/commit/b786b8cc314ce9d45d56ac68c93020209643b208))
232
+ * add viteConfig.ssr.external ([2035967](https://github.com/zhangyuang/ssr/commit/2035967def8d2f9d48997d6994efd8ffbb4fd382))
233
+ * babelExtraModule support vue ([06251e7](https://github.com/zhangyuang/ssr/commit/06251e716678e1f882f06f68f72c518a341de0d7))
234
+ * babelExtraModule support vue ([513073d](https://github.com/zhangyuang/ssr/commit/513073ddcecbb728d34eae233686a93d63355e00))
235
+ * change splitChunks from all to initial ([f0de225](https://github.com/zhangyuang/ssr/commit/f0de22566ff7769b02d3b7d7b75bde12a5b2c28a))
236
+ * don't cover viteConfig.build ([02aef3b](https://github.com/zhangyuang/ssr/commit/02aef3b44c1cde54d8586f0d73defdcdc7ce0ad3))
237
+ * generate html file support inject prefix ([02741ee](https://github.com/zhangyuang/ssr/commit/02741eeda778eec26504c5e7e2c074b1d2402e83))
238
+ * move react-router to external ([0a58570](https://github.com/zhangyuang/ssr/commit/0a585705fb66d9f3a4a59008f1f3e82b23f05fae))
239
+ * optimize customescript ([f374760](https://github.com/zhangyuang/ssr/commit/f3747608d4684576875968394eca6315e2fa8dd1))
240
+ * plugin-midway remove luckyeye ([bb4b11f](https://github.com/zhangyuang/ssr/commit/bb4b11f289d060c8b332cf610bb6d8c4cf25142b))
241
+ * plugin-react add react-refresh, remove module.hot ([7bee211](https://github.com/zhangyuang/ssr/commit/7bee211ddfefaef688713f505756e1155320b844))
242
+ * remove plugin-nestjs deploy ([0ba16f8](https://github.com/zhangyuang/ssr/commit/0ba16f861b6dc679f216cbbcc931de75cdf79501))
243
+ * render add generic function overloading ([f03897f](https://github.com/zhangyuang/ssr/commit/f03897f07844d8fd5f9d2cf3eeef1a726da794bf))
244
+ * set argv.ssl for plugin-midway ([#213](https://github.com/zhangyuang/ssr/issues/213)) ([65c1cb9](https://github.com/zhangyuang/ssr/commit/65c1cb9da0772e915162dcd9b03fad2fada22b40))
245
+ * support htmlTemplate ([b240811](https://github.com/zhangyuang/ssr/commit/b2408114a6314ef4f96f4c06159d18fc6d881a57))
246
+ * support more vite config ([3ac5edc](https://github.com/zhangyuang/ssr/commit/3ac5edc605b59a1e1927fad0838cc730aba82b59))
247
+ * support props.ssrApp in vue3 ([8985037](https://github.com/zhangyuang/ssr/commit/898503753cbe69187d27f91c70dff3f4cd4a0b2a))
248
+ * support vite + wasm vite otherConfig ([7e65899](https://github.com/zhangyuang/ssr/commit/7e658998bc404c28374645c3a8a433a3db171f36))
249
+ * support vuex store options ([9bed529](https://github.com/zhangyuang/ssr/commit/9bed5299a59386e0cd70abbb8a66eca6090ed400))
250
+ * support wasm in webpack, lock postcss-preset-env version ([8ad50a4](https://github.com/zhangyuang/ssr/commit/8ad50a41227a8eb5395c955e5deeda7eb56036b0))
251
+ * support wildcare params ([c5cde18](https://github.com/zhangyuang/ssr/commit/c5cde18566365f9d3bbc81691c0ca5e7b72607d4))
252
+ * update chainBaseConfig ([51c1fbe](https://github.com/zhangyuang/ssr/commit/51c1fbe5a645d4701c7ebc035083096d50301891))
253
+ * update extraJsOrder extraCssOrder ([cd5ca99](https://github.com/zhangyuang/ssr/commit/cd5ca99a686ea565020500a6c4f77e310b422ce3))
254
+ * update fetch params ([70aedaa](https://github.com/zhangyuang/ssr/commit/70aedaa82a69552e22af1998bf1c2de8e30e0283))
255
+ * update midway deploy ([a473c59](https://github.com/zhangyuang/ssr/commit/a473c599657df42b4bf7a59f248b3c7c33907657))
256
+ * update plugin-vue3 support call pinia in fetch.ts ([958fdc7](https://github.com/zhangyuang/ssr/commit/958fdc787ab615593f3114a6bf2c6cea4823afc2))
257
+ * update ssr-common-utils ([c7cadc1](https://github.com/zhangyuang/ssr/commit/c7cadc14922383f8fdaa6c76b4dbe9c220d0ac72))
258
+ * update turbo ([9ee14f5](https://github.com/zhangyuang/ssr/commit/9ee14f59359187e35f4ef990998846ac3847347b))
259
+ * update vite config ([0596573](https://github.com/zhangyuang/ssr/commit/05965738898d96d53dedbd41746b8100dcc5653b))
260
+ * update vue example inject content for consistent ([c863c01](https://github.com/zhangyuang/ssr/commit/c863c011fc06ceed5d204d3d96eea29cf7c7d4b8))
261
+ * upgrade midway example to v3 ([572f7c5](https://github.com/zhangyuang/ssr/commit/572f7c5d171346cc17f5f6cdebe33aee76e0c146))
262
+ * 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))
263
+ * upgrade vue-router^2 to vue-router^3 ([283ed9e](https://github.com/zhangyuang/ssr/commit/283ed9ec4f6d8a622bcc3599ca33f9b0885ed3e5))
264
+ * use pnpm replace yarn workspace and lerna ([#186](https://github.com/zhangyuang/ssr/issues/186)) ([d578506](https://github.com/zhangyuang/ssr/commit/d578506160712847c1dd021b7759c7e9ff3c03e8))
265
+ * use ssr-vite-plugin-style-import ([1c8cac2](https://github.com/zhangyuang/ssr/commit/1c8cac2ff9bb7ec0132c23203efa5c85a8c7492e))
266
+ * use terser minify plugin-react server bundle ([0a3c7fe](https://github.com/zhangyuang/ssr/commit/0a3c7fe61908fe24bcb2d8c6394daf2afd18ba82))
267
+ * vite build extra vendor ([#210](https://github.com/zhangyuang/ssr/issues/210)) ([3eb6e4f](https://github.com/zhangyuang/ssr/commit/3eb6e4fde592a6ef59a7fd6790b56e38c187960d))
268
+ * vite build extra vendor and client-entry ([#211](https://github.com/zhangyuang/ssr/issues/211)) ([41fb1fe](https://github.com/zhangyuang/ssr/commit/41fb1fef04a1c954828d42e4dfe40445bcea444f))
269
+ * vite mode support splitChunk dynamic module ([4157fc2](https://github.com/zhangyuang/ssr/commit/4157fc24176b69c9815450b3623742995feae144))
270
+ * vue3 add default isCustomElement ([44ab37c](https://github.com/zhangyuang/ssr/commit/44ab37c27908b5927578d78a834d2404d42c70dd))
271
+ * vue3 support pinia, replace props.fetchData to props.reactiveFetchData in vue2/3 ([eabcb50](https://github.com/zhangyuang/ssr/commit/eabcb50729517b7cb649729d52356a06a010a8fc))
272
+ * webpack build optimize ([#222](https://github.com/zhangyuang/ssr/issues/222)) ([217dd38](https://github.com/zhangyuang/ssr/commit/217dd388c70d2a7d93d8eeec64a3d26136afe51b))
273
+
274
+
275
+
1
276
  ## [6.2.27](https://github.com/zhangyuang/ssr/compare/v6.2.8...v6.2.27) (2022-07-04)
2
277
 
3
278
 
@@ -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
  }
@@ -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;;;;EA4B3B;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,12 @@ 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
+ spinner.stop();
45
+ }
39
46
  const { webpackBuild } = await Promise.resolve().then(() => require('./tools/webpack'));
40
47
  await webpackBuild();
41
48
  }
@@ -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,UA2CnB,CAAA;AACD,QAAA,MAAM,YAAY,EAAE,UAuCnB,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,UA0CnB,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,12 +1,12 @@
1
1
  "use strict";
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;
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");
8
8
  const ssr_vite_plugin_style_import_1 = require("ssr-vite-plugin-style-import");
9
- const { getOutput, reactServerEntry, reactClientEntry, viteConfig, supportOptinalChaining, isDev, define, babelOptions } = (0, ssr_server_utils_1.loadConfig)();
9
+ const { getOutput, reactServerEntry, reactClientEntry, viteConfig, supportOptinalChaining, isDev, define, babelOptions, optimize } = (0, ssr_server_utils_1.loadConfig)();
10
10
  const { clientOutPut, serverOutPut } = getOutput();
11
11
  const styleImportConfig = {
12
12
  include: ['**/*.vue', '**/*.ts', '**/*.js', '**/*.tsx', '**/*.jsx', /chunkName/],
@@ -50,6 +50,7 @@ const serverConfig = {
50
50
  ssr: reactServerEntry,
51
51
  outDir: serverOutPut,
52
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,
53
54
  input: isDev ? reactClientEntry : reactServerEntry,
54
55
  output: {
55
56
  entryFileNames: 'Page.server.js'
@@ -57,6 +58,7 @@ const serverConfig = {
57
58
  }
58
59
  },
59
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,
60
62
  __isBrowser__: false,
61
63
  ...define === null || define === void 0 ? void 0 : define.base,
62
64
  ...define === null || define === void 0 ? void 0 : define.server
@@ -65,39 +67,42 @@ const serverConfig = {
65
67
  exports.serverConfig = serverConfig;
66
68
  const clientConfig = {
67
69
  ...(0, ssr_server_utils_1.commonConfig)(),
68
- ...(_o = viteConfig === null || viteConfig === void 0 ? void 0 : viteConfig().client) === null || _o === void 0 ? void 0 : _o.otherConfig,
70
+ ...(_t = viteConfig === null || viteConfig === void 0 ? void 0 : viteConfig().client) === null || _t === void 0 ? void 0 : _t.otherConfig,
69
71
  base: isDev ? '/' : (0, ssr_server_utils_1.getOutputPublicPath)(),
70
72
  esbuild: {
71
- ...(_q = (_p = viteConfig === null || viteConfig === void 0 ? void 0 : viteConfig().client) === null || _p === void 0 ? void 0 : _p.otherConfig) === null || _q === void 0 ? void 0 : _q.esbuild,
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,
72
74
  keepNames: true,
73
75
  logOverride: { 'this-is-undefined-in-esm': 'silent' }
74
76
  },
75
77
  optimizeDeps: {
76
- ...(_s = (_r = viteConfig === null || viteConfig === void 0 ? void 0 : viteConfig().client) === null || _r === void 0 ? void 0 : _r.otherConfig) === null || _s === void 0 ? void 0 : _s.optimizeDeps,
77
- include: ['react-router'].concat(...(_w = (_v = (_u = (_t = viteConfig === null || viteConfig === void 0 ? void 0 : viteConfig().client) === null || _t === void 0 ? void 0 : _t.otherConfig) === null || _u === void 0 ? void 0 : _u.optimizeDeps) === null || _v === void 0 ? void 0 : _v.include) !== null && _w !== void 0 ? _w : []),
78
- exclude: ['ssr-hoc-react'].concat(...(_0 = (_z = (_y = (_x = viteConfig === null || viteConfig === void 0 ? void 0 : viteConfig().client) === null || _x === void 0 ? void 0 : _x.otherConfig) === null || _y === void 0 ? void 0 : _y.optimizeDeps) === null || _z === void 0 ? void 0 : _z.exclude) !== null && _0 !== void 0 ? _0 : [])
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 : [])
79
81
  },
80
82
  plugins: [
81
83
  (0, plugin_react_1.default)({
82
- ...(_2 = (_1 = viteConfig === null || viteConfig === void 0 ? void 0 : viteConfig()) === null || _1 === void 0 ? void 0 : _1.client) === null || _2 === void 0 ? void 0 : _2.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,
83
85
  jsxRuntime: 'classic',
84
86
  ...babelOptions
85
87
  }),
86
- (_4 = (_3 = viteConfig === null || viteConfig === void 0 ? void 0 : viteConfig()) === null || _3 === void 0 ? void 0 : _3.common) === null || _4 === void 0 ? void 0 : _4.extraPlugin,
87
- (_6 = (_5 = viteConfig === null || viteConfig === void 0 ? void 0 : viteConfig()) === null || _5 === void 0 ? void 0 : _5.client) === null || _6 === void 0 ? void 0 : _6.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,
88
90
  (0, ssr_vite_plugin_style_import_1.createStyleImportPlugin)(styleImportConfig)
89
91
  ],
90
92
  build: {
91
- ...(_8 = (_7 = viteConfig === null || viteConfig === void 0 ? void 0 : viteConfig().client) === null || _7 === void 0 ? void 0 : _7.otherConfig) === null || _8 === void 0 ? void 0 : _8.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,
94
+ ...(optimize ? { write: false } : {}),
92
95
  ssrManifest: true,
93
96
  outDir: clientOutPut,
94
97
  rollupOptions: {
98
+ ...(_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,
95
99
  input: reactClientEntry,
96
100
  output: ssr_server_utils_1.rollupOutputOptions,
97
101
  plugins: [(0, ssr_server_utils_1.chunkNamePlugin)(), (0, ssr_server_utils_1.asyncOptimizeChunkPlugin)(), (0, ssr_server_utils_1.manifestPlugin)()]
98
102
  }
99
103
  },
100
104
  define: {
105
+ ...(_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,
101
106
  __isBrowser__: true,
102
107
  ...define === null || define === void 0 ? void 0 : define.base,
103
108
  ...define === null || define === void 0 ? void 0 : define.client
@@ -113,3 +118,11 @@ const viteBuild = async () => {
113
118
  await (0, vite_1.build)({ ...serverConfig, mode: 'production' });
114
119
  };
115
120
  exports.viteBuild = viteBuild;
121
+ const viteBuildClient = async () => {
122
+ await (0, vite_1.build)({ ...clientConfig, mode: 'production' });
123
+ };
124
+ exports.viteBuildClient = viteBuildClient;
125
+ const viteBuildServer = async () => {
126
+ await (0, vite_1.build)({ ...serverConfig, mode: 'production' });
127
+ };
128
+ 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
  }
@@ -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;;;;EA4B3B;AAED,cAAc,cAAc,CAAA"}
package/esm/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import { loadConfig } from 'ssr-server-utils';
2
- const { isVite } = loadConfig();
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,12 @@ 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
+ spinner.stop();
28
+ }
22
29
  const { webpackBuild } = await import('./tools/webpack');
23
30
  await webpackBuild();
24
31
  }
@@ -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,UA2CnB,CAAA;AACD,QAAA,MAAM,YAAY,EAAE,UAuCnB,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,UA0CnB,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,9 +1,9 @@
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;
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';
5
5
  import { createStyleImportPlugin, AndDesignVueResolve, VantResolve, ElementPlusResolve, NutuiResolve, AntdResolve } from 'ssr-vite-plugin-style-import';
6
- const { getOutput, reactServerEntry, reactClientEntry, viteConfig, supportOptinalChaining, isDev, define, babelOptions } = loadConfig();
6
+ const { getOutput, reactServerEntry, reactClientEntry, viteConfig, supportOptinalChaining, isDev, define, babelOptions, optimize } = loadConfig();
7
7
  const { clientOutPut, serverOutPut } = getOutput();
8
8
  const styleImportConfig = {
9
9
  include: ['**/*.vue', '**/*.ts', '**/*.js', '**/*.tsx', '**/*.jsx', /chunkName/],
@@ -47,6 +47,7 @@ const serverConfig = {
47
47
  ssr: reactServerEntry,
48
48
  outDir: serverOutPut,
49
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,
50
51
  input: isDev ? reactClientEntry : reactServerEntry,
51
52
  output: {
52
53
  entryFileNames: 'Page.server.js'
@@ -54,6 +55,7 @@ const serverConfig = {
54
55
  }
55
56
  },
56
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,
57
59
  __isBrowser__: false,
58
60
  ...define === null || define === void 0 ? void 0 : define.base,
59
61
  ...define === null || define === void 0 ? void 0 : define.server
@@ -61,39 +63,42 @@ const serverConfig = {
61
63
  };
62
64
  const clientConfig = {
63
65
  ...commonConfig(),
64
- ...(_o = viteConfig === null || viteConfig === void 0 ? void 0 : viteConfig().client) === null || _o === void 0 ? void 0 : _o.otherConfig,
66
+ ...(_t = viteConfig === null || viteConfig === void 0 ? void 0 : viteConfig().client) === null || _t === void 0 ? void 0 : _t.otherConfig,
65
67
  base: isDev ? '/' : getOutputPublicPath(),
66
68
  esbuild: {
67
- ...(_q = (_p = viteConfig === null || viteConfig === void 0 ? void 0 : viteConfig().client) === null || _p === void 0 ? void 0 : _p.otherConfig) === null || _q === void 0 ? void 0 : _q.esbuild,
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,
68
70
  keepNames: true,
69
71
  logOverride: { 'this-is-undefined-in-esm': 'silent' }
70
72
  },
71
73
  optimizeDeps: {
72
- ...(_s = (_r = viteConfig === null || viteConfig === void 0 ? void 0 : viteConfig().client) === null || _r === void 0 ? void 0 : _r.otherConfig) === null || _s === void 0 ? void 0 : _s.optimizeDeps,
73
- include: ['react-router'].concat(...(_w = (_v = (_u = (_t = viteConfig === null || viteConfig === void 0 ? void 0 : viteConfig().client) === null || _t === void 0 ? void 0 : _t.otherConfig) === null || _u === void 0 ? void 0 : _u.optimizeDeps) === null || _v === void 0 ? void 0 : _v.include) !== null && _w !== void 0 ? _w : []),
74
- exclude: ['ssr-hoc-react'].concat(...(_0 = (_z = (_y = (_x = viteConfig === null || viteConfig === void 0 ? void 0 : viteConfig().client) === null || _x === void 0 ? void 0 : _x.otherConfig) === null || _y === void 0 ? void 0 : _y.optimizeDeps) === null || _z === void 0 ? void 0 : _z.exclude) !== null && _0 !== void 0 ? _0 : [])
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 : [])
75
77
  },
76
78
  plugins: [
77
79
  react({
78
- ...(_2 = (_1 = viteConfig === null || viteConfig === void 0 ? void 0 : viteConfig()) === null || _1 === void 0 ? void 0 : _1.client) === null || _2 === void 0 ? void 0 : _2.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,
79
81
  jsxRuntime: 'classic',
80
82
  ...babelOptions
81
83
  }),
82
- (_4 = (_3 = viteConfig === null || viteConfig === void 0 ? void 0 : viteConfig()) === null || _3 === void 0 ? void 0 : _3.common) === null || _4 === void 0 ? void 0 : _4.extraPlugin,
83
- (_6 = (_5 = viteConfig === null || viteConfig === void 0 ? void 0 : viteConfig()) === null || _5 === void 0 ? void 0 : _5.client) === null || _6 === void 0 ? void 0 : _6.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,
84
86
  createStyleImportPlugin(styleImportConfig)
85
87
  ],
86
88
  build: {
87
- ...(_8 = (_7 = viteConfig === null || viteConfig === void 0 ? void 0 : viteConfig().client) === null || _7 === void 0 ? void 0 : _7.otherConfig) === null || _8 === void 0 ? void 0 : _8.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,
90
+ ...(optimize ? { write: false } : {}),
88
91
  ssrManifest: true,
89
92
  outDir: clientOutPut,
90
93
  rollupOptions: {
94
+ ...(_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,
91
95
  input: reactClientEntry,
92
96
  output: rollupOutputOptions,
93
97
  plugins: [chunkNamePlugin(), asyncOptimizeChunkPlugin(), manifestPlugin()]
94
98
  }
95
99
  },
96
100
  define: {
101
+ ...(_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,
97
102
  __isBrowser__: true,
98
103
  ...define === null || define === void 0 ? void 0 : define.base,
99
104
  ...define === null || define === void 0 ? void 0 : define.client
@@ -106,4 +111,10 @@ const viteBuild = async () => {
106
111
  await build({ ...clientConfig, mode: 'production' });
107
112
  await build({ ...serverConfig, mode: 'production' });
108
113
  };
109
- export { viteBuild, viteStart, serverConfig, clientConfig };
114
+ const viteBuildClient = async () => {
115
+ await build({ ...clientConfig, mode: 'production' });
116
+ };
117
+ const viteBuildServer = async () => {
118
+ await build({ ...serverConfig, mode: 'production' });
119
+ };
120
+ 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.27",
3
+ "version": "6.2.30",
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",
@@ -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
  )
package/src/index.ts CHANGED
@@ -1,6 +1,8 @@
1
1
  import { loadConfig } from 'ssr-server-utils'
2
2
 
3
- const { isVite } = loadConfig()
3
+ const { isVite, optimize } = loadConfig()
4
+ const spinner = require('ora')('Building')
5
+
4
6
  export function clientPlugin () {
5
7
  return {
6
8
  name: 'plugin-react',
@@ -18,6 +20,12 @@ 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
+ spinner.stop()
28
+ }
21
29
  const { webpackBuild } = await import('./tools/webpack')
22
30
  await webpackBuild()
23
31
  }
package/src/tools/vite.ts CHANGED
@@ -2,7 +2,7 @@ import { build, UserConfig } from 'vite'
2
2
  import { loadConfig, chunkNamePlugin, rollupOutputOptions, manifestPlugin, commonConfig, asyncOptimizeChunkPlugin, getOutputPublicPath } from 'ssr-server-utils'
3
3
  import react from '@vitejs/plugin-react'
4
4
  import { createStyleImportPlugin, AndDesignVueResolve, VantResolve, ElementPlusResolve, NutuiResolve, AntdResolve } from 'ssr-vite-plugin-style-import'
5
- const { getOutput, reactServerEntry, reactClientEntry, viteConfig, supportOptinalChaining, isDev, define, babelOptions } = loadConfig()
5
+ const { getOutput, reactServerEntry, reactClientEntry, viteConfig, supportOptinalChaining, isDev, define, babelOptions, optimize } = loadConfig()
6
6
  const { clientOutPut, serverOutPut } = getOutput()
7
7
  const styleImportConfig = {
8
8
  include: ['**/*.vue', '**/*.ts', '**/*.js', '**/*.tsx', '**/*.jsx', /chunkName/],
@@ -46,6 +46,7 @@ const serverConfig: UserConfig = {
46
46
  ssr: reactServerEntry,
47
47
  outDir: serverOutPut,
48
48
  rollupOptions: {
49
+ ...viteConfig?.().server?.otherConfig?.build?.rollupOptions,
49
50
  input: isDev ? reactClientEntry : reactServerEntry, // setting prebundle list by client-entry in dev
50
51
  output: {
51
52
  entryFileNames: 'Page.server.js'
@@ -53,6 +54,7 @@ const serverConfig: UserConfig = {
53
54
  }
54
55
  },
55
56
  define: {
57
+ ...viteConfig?.().server?.otherConfig?.define,
56
58
  __isBrowser__: false,
57
59
  ...define?.base,
58
60
  ...define?.server
@@ -84,15 +86,18 @@ const clientConfig: UserConfig = {
84
86
  ],
85
87
  build: {
86
88
  ...viteConfig?.().client?.otherConfig?.build,
89
+ ...(optimize ? { write: false } : {}),
87
90
  ssrManifest: true,
88
91
  outDir: clientOutPut,
89
92
  rollupOptions: {
93
+ ...viteConfig?.().client?.otherConfig?.build?.rollupOptions,
90
94
  input: reactClientEntry,
91
95
  output: rollupOutputOptions,
92
96
  plugins: [chunkNamePlugin(), asyncOptimizeChunkPlugin(), manifestPlugin()]
93
97
  }
94
98
  },
95
99
  define: {
100
+ ...viteConfig?.().client?.otherConfig?.define,
96
101
  __isBrowser__: true,
97
102
  ...define?.base,
98
103
  ...define?.client
@@ -106,9 +111,18 @@ const viteBuild = async () => {
106
111
  await build({ ...serverConfig, mode: 'production' })
107
112
  }
108
113
 
114
+ const viteBuildClient = async () => {
115
+ await build({ ...clientConfig, mode: 'production' })
116
+ }
117
+ const viteBuildServer = async () => {
118
+ await build({ ...serverConfig, mode: 'production' })
119
+ }
120
+
109
121
  export {
110
122
  viteBuild,
111
123
  viteStart,
112
124
  serverConfig,
113
- clientConfig
125
+ clientConfig,
126
+ viteBuildClient,
127
+ viteBuildServer
114
128
  }