保誠-保戶業務員媒合平台
Tomas
2022-05-19 957a1f10a06fdbb76f1a0ba94fe44126c613fee3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
"use strict";
 
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = setupOutputFileSystem;
 
var _path = _interopRequireDefault(require("path"));
 
var _memfs = require("memfs");
 
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
 
function setupOutputFileSystem(context) {
  let outputFileSystem;
 
  if (context.options.outputFileSystem) {
    // eslint-disable-next-line no-shadow
    const {
      outputFileSystem: outputFileSystemFromOptions
    } = context.options; // Todo remove when we drop webpack@4 support
 
    if (typeof outputFileSystemFromOptions.join !== "function") {
      throw new Error("Invalid options: options.outputFileSystem.join() method is expected");
    } // Todo remove when we drop webpack@4 support
 
 
    if (typeof outputFileSystemFromOptions.mkdirp !== "function") {
      throw new Error("Invalid options: options.outputFileSystem.mkdirp() method is expected");
    }
 
    outputFileSystem = outputFileSystemFromOptions;
  } else {
    outputFileSystem = (0, _memfs.createFsFromVolume)(new _memfs.Volume()); // TODO: remove when we drop webpack@4 support
 
    outputFileSystem.join = _path.default.join.bind(_path.default);
  }
 
  const compilers = context.compiler.compilers || [context.compiler];
 
  for (const compiler of compilers) {
    // eslint-disable-next-line no-param-reassign
    compiler.outputFileSystem = outputFileSystem;
  } // eslint-disable-next-line no-param-reassign
 
 
  context.outputFileSystem = outputFileSystem;
}