Skip to content

Commit ed67b60

Browse files
committed
refactor: code
1 parent 95b4c35 commit ed67b60

File tree

2 files changed

+2
-23
lines changed

2 files changed

+2
-23
lines changed

examples/magic-html/webpack.config.js

-3
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@ const { setup } = require("../util");
77
module.exports = setup({
88
context: __dirname,
99
entry: "./app.js",
10-
experiments: {
11-
outputModule: true,
12-
},
1310
devServer: {
1411
magicHtml: true,
1512
},

lib/Server.js

+2-20
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,6 @@ if (!process.env.WEBPACK_SERVE) {
1515
process.env.WEBPACK_SERVE = true;
1616
}
1717

18-
class AssetsInfoPlugin {
19-
constructor(callback) {
20-
this.callback = callback;
21-
}
22-
// eslint-disable-next-line class-methods-use-this
23-
apply(compiler) {
24-
compiler.hooks.done.tap("assets-info-plugin", (stats) => {
25-
this.callback(stats.compilation.assetsInfo);
26-
});
27-
}
28-
}
29-
3018
class Server {
3119
constructor(options = {}, compiler) {
3220
// TODO: remove this after plugin support is published
@@ -1080,12 +1068,6 @@ class Server {
10801068
plugin.apply(compiler);
10811069
}
10821070
}
1083-
1084-
if (this.options.magicHtml) {
1085-
new AssetsInfoPlugin((assetsInfo) => {
1086-
this.assetsInfo = assetsInfo;
1087-
}).apply(this.compiler);
1088-
}
10891071
});
10901072

10911073
if (this.options.client && this.options.client.progress) {
@@ -1962,7 +1944,7 @@ class Server {
19621944
const splitOutputFilename = outputFilename.split(".");
19631945
let isOutputModule = false;
19641946

1965-
this.assetsInfo.forEach((value, key) => {
1947+
this.stats.compilation.assetsInfo.forEach((value, key) => {
19661948
// main.js => ["main", "js"]
19671949
// main.another.js => ["main", "another", "js"]
19681950
const splitKey = key.split(".");
@@ -1972,7 +1954,7 @@ class Server {
19721954
// If key = main.other.mjs && filename = main.other => true
19731955
if (
19741956
splitKey.length - 1 === splitOutputFilename.length &&
1975-
key.split(".")[0] === outputFilename.split(".")[0]
1957+
splitKey[0] === outputFilename.split(".")[0]
19761958
) {
19771959
extension = splitKey[splitKey.length - 1];
19781960
isOutputModule = value.javascriptModule;

0 commit comments

Comments
 (0)