@umijs/bundler-webpack 4.0.0-rc.12 → 4.0.0-rc.15
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/client/client/client.js +15 -7
- package/compiled/fork-ts-checker-webpack-plugin/index.js +1 -1
- package/compiled/webpack/BasicEffectRulePlugin.js +1 -0
- package/compiled/webpack/BasicMatcherRulePlugin.js +1 -0
- package/compiled/webpack/ObjectMatcherRulePlugin.js +1 -0
- package/compiled/webpack/RuleSetCompiler.js +1 -0
- package/compiled/webpack/UseEffectRulePlugin.js +1 -0
- package/compiled/webpack/deepImports.json +6 -1
- package/compiled/webpack/index.js +68 -52
- package/compiled/webpack/types.d.ts +606 -171
- package/compiled/webpack-manifest-plugin/index.js +1 -1
- package/dist/build.d.ts +1 -0
- package/dist/build.js +48 -57
- package/dist/cli.js +6 -15
- package/dist/client/client.js +48 -53
- package/dist/config/_sampleFeature.js +6 -17
- package/dist/config/assetRules.js +44 -55
- package/dist/config/bundleAnalyzerPlugin.js +12 -23
- package/dist/config/compressPlugin.js +68 -76
- package/dist/config/config.d.ts +2 -0
- package/dist/config/config.js +177 -182
- package/dist/config/copyPlugin.js +29 -40
- package/dist/config/cssRules.js +93 -83
- package/dist/config/definePlugin.js +11 -19
- package/dist/config/detectDeadCodePlugin.js +16 -21
- package/dist/config/fastRefreshPlugin.js +11 -22
- package/dist/config/forkTSCheckerPlugin.js +11 -22
- package/dist/config/harmonyLinkingErrorPlugin.js +3 -14
- package/dist/config/ignorePlugin.js +10 -21
- package/dist/config/javaScriptRules.d.ts +1 -0
- package/dist/config/javaScriptRules.js +149 -136
- package/dist/config/manifestPlugin.js +10 -18
- package/dist/config/miniCSSExtractPlugin.js +12 -23
- package/dist/config/nodePolyfill.js +14 -20
- package/dist/config/nodePrefixPlugin.js +8 -19
- package/dist/config/progressPlugin.js +7 -18
- package/dist/config/purgecssWebpackPlugin.js +15 -26
- package/dist/config/speedMeasureWebpackPlugin.js +12 -23
- package/dist/config/svgRules.js +43 -47
- package/dist/dev.d.ts +1 -0
- package/dist/dev.js +103 -99
- package/dist/loader/svgr.js +4 -13
- package/dist/loader/swc.js +9 -14
- package/dist/plugins/ESBuildCSSMinifyPlugin.js +23 -34
- package/dist/plugins/ParcelCSSMinifyPlugin.js +30 -32
- package/dist/schema.js +2 -0
- package/dist/server/server.d.ts +1 -1
- package/dist/server/server.js +161 -182
- package/dist/server/ws.d.ts +3 -1
- package/dist/types.d.ts +3 -6
- package/package.json +8 -10
- package/compiled/tapable/LICENSE +0 -21
- package/compiled/tapable/index.js +0 -1
- package/compiled/tapable/package.json +0 -1
- package/compiled/tapable/tapable.d.ts +0 -116
- package/dist/server/https.d.ts +0 -5
- package/dist/server/https.js +0 -73
package/client/client/client.js
CHANGED
|
@@ -13,21 +13,29 @@ import * as ErrorOverlay from 'react-error-overlay';
|
|
|
13
13
|
import { MESSAGE_TYPE } from '../constants';
|
|
14
14
|
import { formatWebpackMessages } from '../utils/formatWebpackMessages';
|
|
15
15
|
console.log('[webpack] connecting...');
|
|
16
|
-
function
|
|
17
|
-
let l = location;
|
|
16
|
+
function getHost() {
|
|
18
17
|
if (process.env.SOCKET_SERVER) {
|
|
19
|
-
|
|
18
|
+
return new URL(process.env.SOCKET_SERVER);
|
|
20
19
|
}
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
return location;
|
|
21
|
+
}
|
|
22
|
+
function getSocketUrl() {
|
|
23
|
+
let h = getHost();
|
|
24
|
+
const host = h.host;
|
|
25
|
+
const isHttps = h.protocol === 'https:';
|
|
23
26
|
return `${isHttps ? 'wss' : 'ws'}://${host}`;
|
|
24
27
|
}
|
|
28
|
+
function getPingUrl() {
|
|
29
|
+
const h = getHost();
|
|
30
|
+
return `${h.protocol}//${h.host}/__umi_ping`;
|
|
31
|
+
}
|
|
25
32
|
let pingTimer = null;
|
|
26
33
|
let isFirstCompilation = true;
|
|
27
34
|
let mostRecentCompilationHash = null;
|
|
28
35
|
let hasCompileErrors = false;
|
|
29
36
|
let hadRuntimeError = false;
|
|
30
|
-
const
|
|
37
|
+
const pingUrl = getPingUrl();
|
|
38
|
+
const socket = new WebSocket(getSocketUrl(), 'webpack-hmr');
|
|
31
39
|
socket.addEventListener('message', ({ data }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
32
40
|
data = JSON.parse(data);
|
|
33
41
|
if (data.type === 'connected') {
|
|
@@ -45,7 +53,7 @@ function waitForSuccessfulPing(ms = 1000) {
|
|
|
45
53
|
// eslint-disable-next-line no-constant-condition
|
|
46
54
|
while (true) {
|
|
47
55
|
try {
|
|
48
|
-
yield fetch(
|
|
56
|
+
yield fetch(pingUrl);
|
|
49
57
|
break;
|
|
50
58
|
}
|
|
51
59
|
catch (e) {
|