Skip to content

Commit

Permalink
fix: duplate emit source map from child compiler
Browse files Browse the repository at this point in the history
  • Loading branch information
SyMind committed Sep 10, 2024
1 parent 8134f86 commit eaa0bb1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
4 changes: 2 additions & 2 deletions crates/rspack_plugin_devtool/src/mapped_assets_cache.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use dashmap::DashMap;
use futures::Future;
use rspack_core::{CompilationAsset, CompilationAssets};
use rspack_core::CompilationAsset;
use rspack_error::{Error, Result};

use crate::MappedAsset;
Expand All @@ -15,7 +15,7 @@ impl MappedAssetsCache {

pub async fn use_cache<'a, F, R>(
&self,
assets: &'a CompilationAssets,
assets: Vec<(&'a String, &'a CompilationAsset)>,
map_assets: F,
) -> Result<Vec<MappedAsset>>
where
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -506,9 +506,14 @@ async fn process_assets(&self, compilation: &mut Compilation) -> Result<()> {
}

let start = logger.time("collect source maps");
let raw_assets = compilation
.assets()
.iter()
.filter(|(_filename, asset)| asset.info.related.source_map.is_none())
.collect::<Vec<_>>();
let mapped_asstes = self
.mapped_assets_cache
.use_cache(compilation.assets(), |assets| {
.use_cache(raw_assets, |assets| {
self.map_assets(compilation, &file_to_chunk, assets)
})
.await?;
Expand Down

0 comments on commit eaa0bb1

Please sign in to comment.