Skip to content

Commit

Permalink
fix: add built loader of react refresh (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
ClarkXia authored Dec 11, 2023
1 parent c199a56 commit d87e3e2
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
5 changes: 1 addition & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 1 addition & 5 deletions crates/binding_options/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,13 @@ version = "0.1.0"
edition = "2021"

[dependencies]
rspack_binding_macros = { path = "../.rspack_crates/rspack_binding_macros" }
rspack_binding_options = { path = "../.rspack_crates/rspack_binding_options" }
rspack_binding_values = { path = "../.rspack_crates/rspack_binding_values" }
rspack_core = { path = "../.rspack_crates/rspack_core" }
rspack_error = { path = "../.rspack_crates/rspack_error" }
rspack_identifier = { path = "../.rspack_crates/rspack_identifier" }
rspack_ids = { path = "../.rspack_crates/rspack_ids" }
rspack_loader_runner = { path = "../.rspack_crates/rspack_loader_runner" }
rspack_loader_sass = { path = "../.rspack_crates/rspack_loader_sass" }
rspack_loader_swc = { path = "../.rspack_crates/rspack_loader_swc" }
rspack_napi_shared = { path = "../.rspack_crates/rspack_napi_shared" }
rspack_plugin_asset = { path = "../.rspack_crates/rspack_plugin_asset" }
rspack_plugin_banner = { path = "../.rspack_crates/rspack_plugin_banner" }
rspack_plugin_copy = { path = "../.rspack_crates/rspack_plugin_copy" }
Expand Down Expand Up @@ -43,12 +39,12 @@ rspack_plugin_warn_sensitive_module = { path = "../.rspack_crates/rspack_plu
rspack_plugin_wasm = { path = "../.rspack_crates/rspack_plugin_wasm" }
rspack_plugin_web_worker_template = { path = "../.rspack_crates/rspack_plugin_web_worker_template" }
rspack_plugin_worker = { path = "../.rspack_crates/rspack_plugin_worker" }
rspack_loader_react_refresh = { path = "../.rspack_crates/rspack_loader_react_refresh" }
rspack_regex = { path = "../.rspack_crates/rspack_regex" }
rspack_hash = { path = "../.rspack_crates/rspack_hash" }
rspack_swc_visitors = { path = "../.rspack_crates/rspack_swc_visitors" }
loader_compilation = { path = "../loader_compilation" }
plugin_manifest = { path = "../plugin_manifest" }
## plugin_specilize_module_name = { path = "../plugin_specilize_module_name" }

futures-util = { workspace = true }
anyhow = { workspace = true, features = ["backtrace"] }
Expand Down
7 changes: 7 additions & 0 deletions crates/binding_options/src/options/raw_module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use std::sync::Arc;
use rspack_core::BoxLoader;
use rspack_loader_sass::SASS_LOADER_IDENTIFIER;
use rspack_loader_swc::SWC_LOADER_IDENTIFIER;
use rspack_loader_react_refresh::REACT_REFRESH_LOADER_IDENTIFIER;
use loader_compilation::COMPILATION_LOADER_IDENTIFIER;

pub fn get_builtin_loader(builtin: &str, options: Option<&str>) -> BoxLoader {
Expand All @@ -24,6 +25,12 @@ pub fn get_builtin_loader(builtin: &str, options: Option<&str>) -> BoxLoader {
);
}

if builtin.starts_with(REACT_REFRESH_LOADER_IDENTIFIER) {
return Arc::new(
rspack_loader_react_refresh::ReactRefreshLoader::default().with_identifier(builtin.into()),
);
}

if builtin.starts_with(COMPILATION_LOADER_IDENTIFIER) {
return Arc::new(
loader_compilation::CompilationLoader::new(
Expand Down

0 comments on commit d87e3e2

Please sign in to comment.