@umijs/bundler-webpack 4.0.0-canary.20220422.3 → 4.0.0-canary.20220424.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.
@@ -14,12 +14,13 @@ const webpack_1 = require("@umijs/bundler-webpack/compiled/webpack");
14
14
  function addNodePolyfill(opts) {
15
15
  return __awaiter(this, void 0, void 0, function* () {
16
16
  const { config } = opts;
17
+ const nodeLibs = require('node-libs-browser');
17
18
  config.plugin('node-polyfill-provider').use(webpack_1.ProvidePlugin, [
18
19
  {
19
20
  Buffer: ['buffer', 'Buffer'],
21
+ process: nodeLibs['process'],
20
22
  },
21
23
  ]);
22
- const nodeLibs = require('node-libs-browser');
23
24
  config.resolve.fallback.merge(Object.assign(Object.assign({}, Object.keys(nodeLibs).reduce((memo, key) => {
24
25
  if (nodeLibs[key]) {
25
26
  memo[key] = nodeLibs[key];
package/dist/dev.js CHANGED
@@ -15,6 +15,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.dev = exports.stripUndefined = void 0;
16
16
  const mfsu_1 = require("@umijs/mfsu");
17
17
  const utils_1 = require("@umijs/utils");
18
+ const fs_1 = require("fs");
18
19
  const path_1 = require("path");
19
20
  const webpack_1 = __importDefault(require("../compiled/webpack"));
20
21
  const config_1 = require("./config/config");
@@ -112,6 +113,18 @@ function dev(opts) {
112
113
  config: webpackConfig,
113
114
  depConfig: depConfig,
114
115
  }));
116
+ if (mfsu &&
117
+ webpackConfig.cache &&
118
+ typeof webpackConfig.cache === 'object' &&
119
+ webpackConfig.cache.type === 'filesystem') {
120
+ const webpackCachePath = (0, path_1.join)(webpackConfig.cache.cacheDirectory, `default-development`, 'index.pack');
121
+ const mfsuCacheExists = (0, fs_1.existsSync)(mfsu.depInfo.cacheFilePath);
122
+ const webpackCacheExists = (0, fs_1.existsSync)(webpackCachePath);
123
+ if (webpackCacheExists && !mfsuCacheExists) {
124
+ utils_1.logger.warn(`Invalidate webpack cache since mfsu cache is missing`);
125
+ utils_1.rimraf.sync(webpackConfig.cache.cacheDirectory);
126
+ }
127
+ }
115
128
  yield (0, server_1.createServer)({
116
129
  webpackConfig,
117
130
  userConfig: opts.config,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umijs/bundler-webpack",
3
- "version": "4.0.0-canary.20220422.3",
3
+ "version": "4.0.0-canary.20220424.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",
@@ -23,10 +23,10 @@
23
23
  "scripts": {
24
24
  "build": "pnpm tsc",
25
25
  "build:client": "pnpm tsc --project ./tsconfig.client.json",
26
- "build:deps": "pnpm esno ../../scripts/bundleDeps.ts",
26
+ "build:deps": "umi-scripts bundleDeps",
27
27
  "dev": "pnpm build -- --watch",
28
28
  "generate:webpackPackages": "zx ./scripts/generateWebpackPackages.mjs",
29
- "test": "jest -c ../../jest.turbo.config.ts"
29
+ "test": "umi-scripts jest-turbo"
30
30
  },
31
31
  "dependencies": {
32
32
  "@parcel/css": "1.8.1",
@@ -35,10 +35,10 @@
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.20220422.3",
39
- "@umijs/bundler-utils": "4.0.0-canary.20220422.3",
40
- "@umijs/mfsu": "4.0.0-canary.20220422.3",
41
- "@umijs/utils": "4.0.0-canary.20220422.3",
38
+ "@umijs/babel-preset-umi": "4.0.0-canary.20220424.1",
39
+ "@umijs/bundler-utils": "4.0.0-canary.20220424.1",
40
+ "@umijs/mfsu": "4.0.0-canary.20220424.1",
41
+ "@umijs/utils": "4.0.0-canary.20220424.1",
42
42
  "css-loader": "6.7.1",
43
43
  "es5-imcompatible-versions": "^0.1.73",
44
44
  "jest-worker": "27.5.1",