@umijs/bundler-webpack 4.0.0-canary.20220412.3 → 4.0.0-canary.20220418.2

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/build.d.ts CHANGED
@@ -3,6 +3,7 @@ import { IOpts as IConfigOpts } from './config/config';
3
3
  import { IConfig } from './types';
4
4
  declare type IOpts = {
5
5
  cwd: string;
6
+ rootDir?: string;
6
7
  entry: Record<string, string>;
7
8
  config: IConfig;
8
9
  onBuildComplete?: Function;
package/dist/build.js CHANGED
@@ -21,6 +21,7 @@ function build(opts) {
21
21
  return __awaiter(this, void 0, void 0, function* () {
22
22
  const webpackConfig = yield (0, config_1.getConfig)({
23
23
  cwd: opts.cwd,
24
+ rootDir: opts.rootDir,
24
25
  env: types_1.Env.production,
25
26
  entry: opts.entry,
26
27
  userConfig: opts.config,
@@ -2,6 +2,7 @@ import { Configuration } from '../../compiled/webpack';
2
2
  import { Env, IConfig } from '../types';
3
3
  export interface IOpts {
4
4
  cwd: string;
5
+ rootDir?: string;
5
6
  env: Env;
6
7
  entry: Record<string, string>;
7
8
  extraBabelPresets?: any[];
@@ -169,7 +169,8 @@ function getConfig(opts) {
169
169
  config: opts.cache.buildDependencies || [],
170
170
  },
171
171
  cacheDirectory: opts.cache.cacheDirectory ||
172
- (0, path_1.join)(opts.cwd, 'node_modules', '.cache', 'bundler-webpack'),
172
+ // 使用 rootDir 是在有 APP_ROOT 时,把 cache 目录放在根目录下
173
+ (0, path_1.join)(opts.rootDir || opts.cwd, 'node_modules', '.cache', 'bundler-webpack'),
173
174
  });
174
175
  // tnpm 安装依赖的情况 webpack 默认的 managedPaths 不生效
175
176
  // 使用 immutablePaths 避免 node_modules 的内容被写入缓存
@@ -178,7 +179,8 @@ function getConfig(opts) {
178
179
  if ( /*isTnpm*/require('@umijs/utils/package').__npminstall_done) {
179
180
  config.snapshot({
180
181
  immutablePaths: [
181
- opts.cache.absNodeModulesPath || (0, path_1.join)(opts.cwd, 'node_modules'),
182
+ opts.cache.absNodeModulesPath ||
183
+ (0, path_1.join)(opts.rootDir || opts.cwd, 'node_modules'),
182
184
  ],
183
185
  });
184
186
  }
package/dist/dev.d.ts CHANGED
@@ -16,6 +16,7 @@ declare type IOpts = {
16
16
  extraBabelPlugins?: any[];
17
17
  extraBabelPresets?: any[];
18
18
  cwd: string;
19
+ rootDir?: string;
19
20
  config: IConfig;
20
21
  entry: Record<string, string>;
21
22
  } & Pick<IConfigOpts, 'cache'>;
package/dist/dev.js CHANGED
@@ -49,7 +49,7 @@ function dev(opts) {
49
49
  mfName: (_c = opts.config.mfsu) === null || _c === void 0 ? void 0 : _c.mfName,
50
50
  runtimePublicPath: opts.config.runtimePublicPath,
51
51
  tmpBase: ((_d = opts.config.mfsu) === null || _d === void 0 ? void 0 : _d.cacheDirectory) ||
52
- (0, path_1.join)(opts.cwd, 'node_modules/.cache/mfsu'),
52
+ (0, path_1.join)(opts.rootDir || opts.cwd, 'node_modules/.cache/mfsu'),
53
53
  onMFSUProgress: opts.onMFSUProgress,
54
54
  getCacheDependency() {
55
55
  var _a;
@@ -67,6 +67,7 @@ function dev(opts) {
67
67
  }
68
68
  const webpackConfig = yield (0, config_1.getConfig)({
69
69
  cwd: opts.cwd,
70
+ rootDir: opts.rootDir,
70
71
  env: types_1.Env.development,
71
72
  entry: opts.entry,
72
73
  userConfig: opts.config,
@@ -89,6 +90,7 @@ function dev(opts) {
89
90
  });
90
91
  const depConfig = yield (0, config_1.getConfig)({
91
92
  cwd: opts.cwd,
93
+ rootDir: opts.rootDir,
92
94
  env: types_1.Env.development,
93
95
  entry: opts.entry,
94
96
  userConfig: opts.config,
@@ -98,7 +100,7 @@ function dev(opts) {
98
100
  chainWebpack: (_e = opts.config.mfsu) === null || _e === void 0 ? void 0 : _e.chainWebpack,
99
101
  cache: {
100
102
  buildDependencies: (_f = opts.cache) === null || _f === void 0 ? void 0 : _f.buildDependencies,
101
- cacheDirectory: (0, path_1.join)(opts.cwd, 'node_modules', '.cache', 'mfsu-deps'),
103
+ cacheDirectory: (0, path_1.join)(opts.rootDir || opts.cwd, 'node_modules', '.cache', 'mfsu-deps'),
102
104
  },
103
105
  });
104
106
  (_g = webpackConfig.resolve).alias || (_g.alias = {});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umijs/bundler-webpack",
3
- "version": "4.0.0-canary.20220412.3",
3
+ "version": "4.0.0-canary.20220418.2",
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",
@@ -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.20220412.3",
39
- "@umijs/bundler-utils": "4.0.0-canary.20220412.3",
40
- "@umijs/mfsu": "4.0.0-canary.20220412.3",
41
- "@umijs/utils": "4.0.0-canary.20220412.3",
38
+ "@umijs/babel-preset-umi": "4.0.0-canary.20220418.2",
39
+ "@umijs/bundler-utils": "4.0.0-canary.20220418.2",
40
+ "@umijs/mfsu": "4.0.0-canary.20220418.2",
41
+ "@umijs/utils": "4.0.0-canary.20220418.2",
42
42
  "css-loader": "6.7.1",
43
43
  "es5-imcompatible-versions": "^0.1.73",
44
44
  "jest-worker": "27.5.1",