@umijs/bundler-webpack 4.0.0-canary.20220318.1 → 4.0.0-canary.20220323.1

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/dist/dev.js CHANGED
@@ -22,8 +22,8 @@ const constants_1 = require("./constants");
22
22
  const server_1 = require("./server/server");
23
23
  const types_1 = require("./types");
24
24
  function dev(opts) {
25
- var _a, _b, _c, _d, _e;
26
- var _f;
25
+ var _a, _b, _c, _d, _e, _f;
26
+ var _g;
27
27
  return __awaiter(this, void 0, void 0, function* () {
28
28
  const enableMFSU = opts.config.mfsu !== false;
29
29
  let mfsu = null;
@@ -80,12 +80,13 @@ function dev(opts) {
80
80
  hash: true,
81
81
  staticPathPrefix: mfsu_1.MF_DEP_PREFIX,
82
82
  name: constants_1.MFSU_NAME,
83
+ chainWebpack: (_e = opts.config.mfsu) === null || _e === void 0 ? void 0 : _e.chainWebpack,
83
84
  cache: {
84
- buildDependencies: (_e = opts.cache) === null || _e === void 0 ? void 0 : _e.buildDependencies,
85
+ buildDependencies: (_f = opts.cache) === null || _f === void 0 ? void 0 : _f.buildDependencies,
85
86
  cacheDirectory: (0, path_1.join)(opts.cwd, 'node_modules', '.cache', 'mfsu-deps'),
86
87
  },
87
88
  });
88
- (_f = webpackConfig.resolve).alias || (_f.alias = {});
89
+ (_g = webpackConfig.resolve).alias || (_g.alias = {});
89
90
  // TODO: REMOVE ME
90
91
  ['@umijs/utils/compiled/strip-ansi', 'react-error-overlay'].forEach((dep) => {
91
92
  // @ts-ignore
package/dist/schema.js CHANGED
@@ -40,8 +40,8 @@ function getSchemas() {
40
40
  devtool: (Joi) => Joi.alternatives().try(Joi.string().regex(DEVTOOL_REGEX), Joi.boolean()),
41
41
  esm: (Joi) => Joi.object(),
42
42
  externals: (Joi) => Joi.alternatives().try(Joi.object(), Joi.string(), Joi.func()),
43
- extraBabelPlugins: (Joi) => Joi.alternatives().try(Joi.string(), Joi.array().items(Joi.alternatives().try(Joi.string(), Joi.object()))),
44
- extraBabelPresets: (Joi) => Joi.alternatives().try(Joi.string(), Joi.array().items(Joi.alternatives().try(Joi.string(), Joi.object()))),
43
+ extraBabelPlugins: (Joi) => Joi.array().items(Joi.alternatives().try(Joi.string(), Joi.array())),
44
+ extraBabelPresets: (Joi) => Joi.array().items(Joi.alternatives().try(Joi.string(), Joi.array())),
45
45
  extraPostCSSPlugins: (Joi) => Joi.array(),
46
46
  fastRefresh: (Joi) => Joi.boolean(),
47
47
  forkTSChecker: (Joi) => Joi.object(),
@@ -58,6 +58,7 @@ function getSchemas() {
58
58
  }),
59
59
  mfsu: (Joi) => Joi.alternatives(Joi.object({
60
60
  cacheDirectory: Joi.string(),
61
+ chainWebpack: Joi.function(),
61
62
  esbuild: Joi.boolean(),
62
63
  mfName: Joi.string(),
63
64
  }), Joi.boolean()),
@@ -133,7 +133,17 @@ function createServer(opts) {
133
133
  // proxy
134
134
  if (proxy) {
135
135
  Object.keys(proxy).forEach((key) => {
136
- app.use(key, (0, http_proxy_middleware_1.createProxyMiddleware)(proxy[key]));
136
+ const proxyConfig = proxy[key];
137
+ const target = proxyConfig.target;
138
+ if (target) {
139
+ app.use(key, (0, http_proxy_middleware_1.createProxyMiddleware)(key, Object.assign(Object.assign({}, proxy[key]), {
140
+ // Add x-real-url in response header
141
+ onProxyRes(proxyRes, req) {
142
+ var _a;
143
+ proxyRes.headers['x-real-url'] =
144
+ ((_a = new URL(req.url || '', target)) === null || _a === void 0 ? void 0 : _a.href) || '';
145
+ } })));
146
+ }
137
147
  });
138
148
  }
139
149
  // after middlewares
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umijs/bundler-webpack",
3
- "version": "4.0.0-canary.20220318.1",
3
+ "version": "4.0.0-canary.20220323.1",
4
4
  "description": "@umijs/bundler-webpack",
5
5
  "homepage": "https://github.com/umijs/umi-next/tree/master/packages/bundler-webpack#readme",
6
6
  "bugs": "https://github.com/umijs/umi-next/issues",
@@ -29,21 +29,21 @@
29
29
  "test": "jest -c ../../jest.turbo.config.ts"
30
30
  },
31
31
  "dependencies": {
32
- "@parcel/css": "1.6.0",
32
+ "@parcel/css": "1.7.2",
33
33
  "@pmmmwh/react-refresh-webpack-plugin": "0.5.4",
34
34
  "@svgr/core": "6.2.1",
35
35
  "@svgr/plugin-jsx": "^6.2.1",
36
36
  "@svgr/plugin-svgo": "^6.2.0",
37
37
  "@types/hapi__joi": "17.1.8",
38
- "@umijs/babel-preset-umi": "4.0.0-canary.20220318.1",
39
- "@umijs/mfsu": "4.0.0-canary.20220318.1",
40
- "@umijs/utils": "4.0.0-canary.20220318.1",
38
+ "@umijs/babel-preset-umi": "4.0.0-canary.20220323.1",
39
+ "@umijs/mfsu": "4.0.0-canary.20220323.1",
40
+ "@umijs/utils": "4.0.0-canary.20220323.1",
41
41
  "css-loader": "6.7.1",
42
42
  "es5-imcompatible-versions": "^0.1.73",
43
43
  "jest-worker": "27.5.1",
44
44
  "node-libs-browser": "2.2.1",
45
45
  "postcss": "^8.4.12",
46
- "postcss-preset-env": "7.4.2",
46
+ "postcss-preset-env": "7.4.3",
47
47
  "react-error-overlay": "6.0.9"
48
48
  },
49
49
  "devDependencies": {
@@ -51,12 +51,12 @@
51
51
  "@types/webpack-sources": "3.2.0",
52
52
  "@types/ws": "8.5.3",
53
53
  "autoprefixer": "10.4.4",
54
- "babel-loader": "8.2.3",
54
+ "babel-loader": "8.2.4",
55
55
  "compression": "1.7.4",
56
56
  "connect-history-api-fallback": "1.6.0",
57
57
  "copy-webpack-plugin": "10.2.4",
58
58
  "css-minimizer-webpack-plugin": "3.4.1",
59
- "cssnano": "5.1.4",
59
+ "cssnano": "5.1.5",
60
60
  "fork-ts-checker-webpack-plugin": "7.2.1",
61
61
  "http-proxy-middleware": "2.0.4",
62
62
  "less-loader": "10.2.0",