Skip to content

Commit

Permalink
fix: initial build error should be dismissed if fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
h-a-n-a committed Apr 10, 2024
1 parent 26e4eef commit a23086a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 14 deletions.
26 changes: 12 additions & 14 deletions crates/rspack_core/src/cache/occasion/build_module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ impl BuildModuleOccasion {
let mut need_cache = false;
let mut last_build_result = None;
let id = module.identifier().to_owned();
if module.as_normal_module().is_some() {
if let Some(module) = module.as_normal_module_mut() {
// normal module
// TODO cache all module type
if let Some((snapshot, data, module_data, extra_data)) = storage.get(&id) {
Expand All @@ -86,21 +86,19 @@ impl BuildModuleOccasion {
false
};
if valid {
if let Some(module) = module.as_normal_module_mut() {
if let Some(module_data) = module_data {
*module.source_mut() = module_data.source;
*module.code_generation_dependencies_mut() = module_data.code_generation_dependencies;
*module.presentational_dependencies_mut() = module_data.presentational_dependencies;
if let (Some(build_info), Some(build_meta)) =
(module_data.build_info, module_data.build_meta)
{
module.set_module_build_info_and_meta(build_info, build_meta);
}
}
if let Some(extra_data) = extra_data {
module.parser_and_generator_mut().resume(&extra_data);
if let Some(module_data) = module_data {
*module.source_mut() = module_data.source;
*module.code_generation_dependencies_mut() = module_data.code_generation_dependencies;
*module.presentational_dependencies_mut() = module_data.presentational_dependencies;
if let (Some(build_info), Some(build_meta)) =
(module_data.build_info, module_data.build_meta)
{
module.set_module_build_info_and_meta(build_info, build_meta);
}
}
if let Some(extra_data) = extra_data {
module.parser_and_generator_mut().resume(&extra_data);
}
return Ok((Ok(data), true));
} else {
last_build_result = Some(data.inner);
Expand Down
1 change: 1 addition & 0 deletions crates/rspack_core/src/compiler/make/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ impl UpdateModuleGraph {
let module_graph = compilation.get_module_graph();
// calc need_check_isolated_module_ids & regen_module_issues
for id in deps_builder.get_force_build_modules() {
compilation.cache.build_module_occasion.remove_cache(id);
if let Some(mgm) = compilation
.get_module_graph()
.module_graph_module_by_identifier(id)
Expand Down

0 comments on commit a23086a

Please sign in to comment.