Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/HotModuleReplacementPlugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ class HotModuleReplacementPlugin {
}
}
}
parser.walkExpressions(expr.arguments);
return true;
});
parser.hooks.call
Expand Down
9 changes: 9 additions & 0 deletions test/hotCases/define/issue-6962/a.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
export default 1;

module.hot.dispose(data => {
data.crash = true;
})
module.hot.accept(() => {
expect(DEFINE_PATH).toBe("./a");
module.hot.invalidate();
});
---
if (module.hot.data && module.hot.data.crash) throw new Error();
export default 2;
15 changes: 9 additions & 6 deletions test/hotCases/define/issue-6962/module.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
import value1 from "./a";

it("should have the expected static path defined", function() {
expect(DEFINE_PATH).toBe('./a');
it("should have the expected static path defined", function () {
expect(DEFINE_PATH).toBe("./a");
});

it("should hot.accept the module located at the static file path without breaking the compiler", function() {
it("should hot.accept the module located at the static file path without breaking the compiler", function () {
module.hot.accept("./a");
expect(value1).toBe(1);
});

it("should hot.accept the module located at the defined file path without breaking the compiler, when one argument is passed to hot.accept", function() {
it("should hot.accept the module located at the defined file path without breaking the compiler, when one argument is passed to hot.accept", function () {
module.hot.accept(DEFINE_PATH);
});

it("should hot.accept the module located at the defined file path without breaking the compiler, when multiple arguments are passed to hot.accept", function(done) {
module.hot.accept(DEFINE_PATH, () => done());
it("should hot.accept the module located at the defined file path without breaking the compiler, when multiple arguments are passed to hot.accept", function (done) {
module.hot.accept(DEFINE_PATH, () => {
expect(DEFINE_PATH).toBe("./a");
done();
});
NEXT(require("../../update")(done));
});