Skip to content

Commit 3c6c6dc

Browse files
feat: remove cjs wrapper
1 parent 5bb33a9 commit 3c6c6dc

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

src/utils/setupOutputFileSystem.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
const path = require("path");
2-
3-
const { createFsFromVolume, Volume } = require("memfs");
2+
const memfs = require("memfs");
43

54
/** @typedef {import("webpack").MultiCompiler} MultiCompiler */
65
/** @typedef {import("../index.js").IncomingMessage} IncomingMessage */
@@ -34,7 +33,7 @@ function setupOutputFileSystem(context) {
3433

3534
outputFileSystem = outputFileSystemFromOptions;
3635
} else {
37-
outputFileSystem = createFsFromVolume(new Volume());
36+
outputFileSystem = memfs.createFsFromVolume(new memfs.Volume());
3837
// TODO: remove when we drop webpack@4 support
3938
// @ts-ignore
4039
outputFileSystem.join = path.join.bind(path);

test/helpers/runner.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const express = require("express");
44
const webpack = require("webpack");
55
const merge = require("deepmerge");
66

7-
const middleware = require("../../dist").default;
7+
const middleware = require("../../dist");
88
const defaultConfig = require("../fixtures/webpack.config");
99

1010
const configEntries = [];

test/utils/setupOutputFileSystem.test.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ describe("setupOutputFileSystem", () => {
2020
compiler: {},
2121
options: {},
2222
};
23+
2324
setupOutputFileSystem(context);
25+
2426
// make sure that this is the default fs created
2527
expect(context.compiler.outputFileSystem.testFs).toBeTruthy();
2628
expect(context.outputFileSystem.testFs).toBeTruthy();
@@ -36,7 +38,9 @@ describe("setupOutputFileSystem", () => {
3638
},
3739
options: {},
3840
};
41+
3942
setupOutputFileSystem(context);
43+
4044
context.compiler.compilers.forEach((comp) => {
4145
expect(comp.outputFileSystem).toBeTruthy();
4246
});
@@ -49,6 +53,7 @@ describe("setupOutputFileSystem", () => {
4953
outputFileSystem: {},
5054
},
5155
};
56+
5257
expect(() => {
5358
setupOutputFileSystem(context);
5459
}).toThrow(/join/);
@@ -63,6 +68,7 @@ describe("setupOutputFileSystem", () => {
6368
},
6469
},
6570
};
71+
6672
expect(() => {
6773
setupOutputFileSystem(context);
6874
}).toThrow(/mkdirp/);
@@ -78,7 +84,9 @@ describe("setupOutputFileSystem", () => {
7884
},
7985
},
8086
};
87+
8188
setupOutputFileSystem(context);
89+
8290
expect(context.outputFileSystem).toEqual(context.options.outputFileSystem);
8391
});
8492
});

0 commit comments

Comments
 (0)