@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.
Files changed (57) hide show
  1. package/client/client/client.js +15 -7
  2. package/compiled/fork-ts-checker-webpack-plugin/index.js +1 -1
  3. package/compiled/webpack/BasicEffectRulePlugin.js +1 -0
  4. package/compiled/webpack/BasicMatcherRulePlugin.js +1 -0
  5. package/compiled/webpack/ObjectMatcherRulePlugin.js +1 -0
  6. package/compiled/webpack/RuleSetCompiler.js +1 -0
  7. package/compiled/webpack/UseEffectRulePlugin.js +1 -0
  8. package/compiled/webpack/deepImports.json +6 -1
  9. package/compiled/webpack/index.js +68 -52
  10. package/compiled/webpack/types.d.ts +606 -171
  11. package/compiled/webpack-manifest-plugin/index.js +1 -1
  12. package/dist/build.d.ts +1 -0
  13. package/dist/build.js +48 -57
  14. package/dist/cli.js +6 -15
  15. package/dist/client/client.js +48 -53
  16. package/dist/config/_sampleFeature.js +6 -17
  17. package/dist/config/assetRules.js +44 -55
  18. package/dist/config/bundleAnalyzerPlugin.js +12 -23
  19. package/dist/config/compressPlugin.js +68 -76
  20. package/dist/config/config.d.ts +2 -0
  21. package/dist/config/config.js +177 -182
  22. package/dist/config/copyPlugin.js +29 -40
  23. package/dist/config/cssRules.js +93 -83
  24. package/dist/config/definePlugin.js +11 -19
  25. package/dist/config/detectDeadCodePlugin.js +16 -21
  26. package/dist/config/fastRefreshPlugin.js +11 -22
  27. package/dist/config/forkTSCheckerPlugin.js +11 -22
  28. package/dist/config/harmonyLinkingErrorPlugin.js +3 -14
  29. package/dist/config/ignorePlugin.js +10 -21
  30. package/dist/config/javaScriptRules.d.ts +1 -0
  31. package/dist/config/javaScriptRules.js +149 -136
  32. package/dist/config/manifestPlugin.js +10 -18
  33. package/dist/config/miniCSSExtractPlugin.js +12 -23
  34. package/dist/config/nodePolyfill.js +14 -20
  35. package/dist/config/nodePrefixPlugin.js +8 -19
  36. package/dist/config/progressPlugin.js +7 -18
  37. package/dist/config/purgecssWebpackPlugin.js +15 -26
  38. package/dist/config/speedMeasureWebpackPlugin.js +12 -23
  39. package/dist/config/svgRules.js +43 -47
  40. package/dist/dev.d.ts +1 -0
  41. package/dist/dev.js +103 -99
  42. package/dist/loader/svgr.js +4 -13
  43. package/dist/loader/swc.js +9 -14
  44. package/dist/plugins/ESBuildCSSMinifyPlugin.js +23 -34
  45. package/dist/plugins/ParcelCSSMinifyPlugin.js +30 -32
  46. package/dist/schema.js +2 -0
  47. package/dist/server/server.d.ts +1 -1
  48. package/dist/server/server.js +161 -182
  49. package/dist/server/ws.d.ts +3 -1
  50. package/dist/types.d.ts +3 -6
  51. package/package.json +8 -10
  52. package/compiled/tapable/LICENSE +0 -21
  53. package/compiled/tapable/index.js +0 -1
  54. package/compiled/tapable/package.json +0 -1
  55. package/compiled/tapable/tapable.d.ts +0 -116
  56. package/dist/server/https.d.ts +0 -5
  57. package/dist/server/https.js +0 -73
@@ -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 getSocketHost() {
17
- let l = location;
16
+ function getHost() {
18
17
  if (process.env.SOCKET_SERVER) {
19
- l = new URL(process.env.SOCKET_SERVER);
18
+ return new URL(process.env.SOCKET_SERVER);
20
19
  }
21
- const host = l.host;
22
- const isHttps = l.protocol === 'https:';
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 socket = new WebSocket(getSocketHost(), 'webpack-hmr');
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(`/__umi_ping`);
56
+ yield fetch(pingUrl);
49
57
  break;
50
58
  }
51
59
  catch (e) {