Skip to content

Commit 3024078

Browse files
authored
Merge pull request webpack#6788 from byzyk/fix/6779
fix: Chunks is not iterable when using source maps with ProfilingPlugin
2 parents c6b9b9e + d061aba commit 3024078

File tree

4 files changed

+35
-2
lines changed

4 files changed

+35
-2
lines changed

lib/debug/ProfilingPlugin.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -305,16 +305,16 @@ const interceptAllParserHooks = (moduleFactory, tracer) => {
305305
};
306306

307307
const makeInterceptorFor = (instance, tracer) => hookName => ({
308-
register: ({ name, type, fn }) => {
308+
register: ({ name, type, context, fn }) => {
309309
const newFn = makeNewProfiledTapFn(hookName, tracer, {
310310
name,
311311
type,
312312
fn
313313
});
314314
return {
315-
// eslint-disable-line
316315
name,
317316
type,
317+
context,
318318
fn: newFn
319319
};
320320
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
it("bundle0 should include sourcemapped test.js", function() {
2+
var fs = require("fs");
3+
var source = fs.readFileSync(__filename + ".map", "utf-8");
4+
var map = JSON.parse(source);
5+
map.sources.should.containEql("webpack:///./test.js");
6+
});
7+
8+
require.include("./test.js");
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
var foo = {};
2+
3+
module.exports = foo;
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
var webpack = require("../../../../");
2+
var path = require("path");
3+
var os = require("os");
4+
5+
module.exports = {
6+
node: {
7+
__dirname: false,
8+
__filename: false
9+
},
10+
entry: {
11+
bundle0: ["./index.js"]
12+
},
13+
output: {
14+
filename: "[name].js"
15+
},
16+
plugins: [
17+
new webpack.debug.ProfilingPlugin({
18+
outputPath: path.join(os.tmpdir(), "events.json")
19+
})
20+
],
21+
devtool: "source-map"
22+
};

0 commit comments

Comments
 (0)