source: trip-planner-front/node_modules/webpack-dev-middleware/dist/utils/setupOutputFileSystem.js@ bdd6491

Last change on this file since bdd6491 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 1.5 KB
RevLine 
[6a3a178]1"use strict";
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6exports.default = setupOutputFileSystem;
7
8var _path = _interopRequireDefault(require("path"));
9
10var _memfs = require("memfs");
11
12function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
14function setupOutputFileSystem(context) {
15 let outputFileSystem;
16
17 if (context.options.outputFileSystem) {
18 // eslint-disable-next-line no-shadow
19 const {
20 outputFileSystem: outputFileSystemFromOptions
21 } = context.options; // Todo remove when we drop webpack@4 support
22
23 if (typeof outputFileSystemFromOptions.join !== "function") {
24 throw new Error("Invalid options: options.outputFileSystem.join() method is expected");
25 } // Todo remove when we drop webpack@4 support
26
27
28 if (typeof outputFileSystemFromOptions.mkdirp !== "function") {
29 throw new Error("Invalid options: options.outputFileSystem.mkdirp() method is expected");
30 }
31
32 outputFileSystem = outputFileSystemFromOptions;
33 } else {
34 outputFileSystem = (0, _memfs.createFsFromVolume)(new _memfs.Volume()); // TODO: remove when we drop webpack@4 support
35
36 outputFileSystem.join = _path.default.join.bind(_path.default);
37 }
38
39 const compilers = context.compiler.compilers || [context.compiler];
40
41 for (const compiler of compilers) {
42 // eslint-disable-next-line no-param-reassign
43 compiler.outputFileSystem = outputFileSystem;
44 } // eslint-disable-next-line no-param-reassign
45
46
47 context.outputFileSystem = outputFileSystem;
48}
Note: See TracBrowser for help on using the repository browser.