fix infinite loop on circular inner graph references
This commit is contained in:
parent
6709efb409
commit
7733d2b1c1
|
@ -117,6 +117,7 @@ class InnerGraphPlugin {
|
|||
if (itemValue !== undefined) {
|
||||
for (const i of itemValue) {
|
||||
if (i === key) continue;
|
||||
if (value.has(i)) continue;
|
||||
newSet.add(i);
|
||||
if (typeof i !== "string") {
|
||||
isTerminal = false;
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
import { x, y, z, a, f3 } from "./module";
|
||||
|
||||
it("should be able to handle circular referenced", () => {
|
||||
expect(x()).toEqual([y, z]);
|
||||
const [_a, b, c, d] = a();
|
||||
expect(b()).toEqual([a, b, c, d]);
|
||||
expect(c()).toEqual([a, b, c, d]);
|
||||
expect(d()).toEqual([a, b, c, d]);
|
||||
const [f2, f4] = f3();
|
||||
const [f1, _f3] = f2();
|
||||
expect(_f3).toBe(f3);
|
||||
expect(f3()).toEqual(f1());
|
||||
expect(f2()).toEqual(f4());
|
||||
});
|
|
@ -0,0 +1,49 @@
|
|||
function x() {
|
||||
return [y, z];
|
||||
}
|
||||
|
||||
function y() {
|
||||
return [x, z];
|
||||
}
|
||||
|
||||
function z() {
|
||||
return [x, y];
|
||||
}
|
||||
|
||||
export { x, y, z };
|
||||
|
||||
function a() {
|
||||
return [a, b, c, d];
|
||||
}
|
||||
|
||||
function b() {
|
||||
return [a, b, c, d];
|
||||
}
|
||||
|
||||
function c() {
|
||||
return [a, b, c, d];
|
||||
}
|
||||
|
||||
function d() {
|
||||
return [a, b, c, d];
|
||||
}
|
||||
|
||||
export { a };
|
||||
|
||||
function f1() {
|
||||
return [f2, f4];
|
||||
}
|
||||
|
||||
function f2() {
|
||||
return [f1, f3];
|
||||
}
|
||||
|
||||
function f3() {
|
||||
return [f2, f4];
|
||||
}
|
||||
|
||||
function f4() {
|
||||
return [f1, f3];
|
||||
}
|
||||
|
||||
export { f3 };
|
|
@ -0,0 +1,24 @@
|
|||
/******/ (() => { // webpackBootstrap
|
||||
/******/ var __webpack_modules__ = ({
|
||||
|
||||
/***/ "./test/fixtures/temp-watch-1569996664301/file.js":
|
||||
/*!****************************************************************!*\
|
||||
!*** (webpack)/test/fixtures/temp-watch-1569996664301/file.js ***!
|
||||
\****************************************************************/
|
||||
/*! exports [maybe provided (runtime-defined)] [no usage info] */
|
||||
/*! runtime requirements: */
|
||||
/***/ (() => {
|
||||
|
||||
eval("'bar'\n\n//# sourceURL=webpack:///(webpack)/test/fixtures/temp-watch-1569996664301/file.js?");
|
||||
|
||||
/***/ })
|
||||
|
||||
/******/ });
|
||||
/************************************************************************/
|
||||
/******/
|
||||
/************************************************************************/
|
||||
/******/ // startup
|
||||
/******/ // Load entry module
|
||||
/******/ __webpack_modules__["./test/fixtures/temp-watch-1569996664301/file.js"]();
|
||||
/******/ })()
|
||||
;
|
Loading…
Reference in New Issue