Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(webpack): hot reload fails after compile error (fixes #762) #775

Merged
merged 1 commit into from Jun 6, 2021
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 5 additions & 2 deletions packages/webpack4-loader/src/index.ts
Expand Up @@ -82,8 +82,11 @@ export default function webpack4Loader(

try {
// Use webpack's resolution when evaluating modules
Module._resolveFilename = (id, { filename }) =>
resolveSync(path.dirname(filename), id);
Module._resolveFilename = (id, { filename }) => {
const result = resolveSync(path.dirname(filename), id);
this.addDependency(result);
return result;
};

result = transform(content, {
filename: path.relative(process.cwd(), this.resourcePath),
Expand Down
1 change: 1 addition & 0 deletions packages/webpack5-loader/src/index.ts
Expand Up @@ -87,6 +87,7 @@ export default function webpack5Loader(
throw new Error('No result');
}

this.addDependency(result);
return result;
};

Expand Down