From 42e679e34d80cc45c10b8a23dfb7e9e637bec4e6 Mon Sep 17 00:00:00 2001 From: wumingliang Date: Sun, 21 Sep 2025 10:51:18 +0800 Subject: [PATCH] fix(rust-plugins): invalid worker extension --- .changeset/late-moles-decide.md | 5 +++++ .changeset/pre.json | 1 + rust-plugins/worker/CHANGELOG.md | 6 ++++++ rust-plugins/worker/package.json | 2 +- rust-plugins/worker/src/lib.rs | 8 ++++---- 5 files changed, 17 insertions(+), 5 deletions(-) create mode 100644 .changeset/late-moles-decide.md diff --git a/.changeset/late-moles-decide.md b/.changeset/late-moles-decide.md new file mode 100644 index 0000000..a041bfb --- /dev/null +++ b/.changeset/late-moles-decide.md @@ -0,0 +1,5 @@ +--- +"@farmfe/plugin-worker": patch +--- + +Fix invalid worker output extension diff --git a/.changeset/pre.json b/.changeset/pre.json index 429dc8e..7704552 100644 --- a/.changeset/pre.json +++ b/.changeset/pre.json @@ -30,6 +30,7 @@ "beige-eyes-repeat", "blue-crabs-fail", "brown-turkeys-clean", + "late-moles-decide", "tender-cats-swim" ] } diff --git a/rust-plugins/worker/CHANGELOG.md b/rust-plugins/worker/CHANGELOG.md index 042dd61..29d631a 100644 --- a/rust-plugins/worker/CHANGELOG.md +++ b/rust-plugins/worker/CHANGELOG.md @@ -1,5 +1,11 @@ # @farmfe/plugin-worker +## 2.0.0-beta.1 + +### Patch Changes + +- Fix invalid worker output extension + ## 2.0.0-beta.0 ### Major Changes diff --git a/rust-plugins/worker/package.json b/rust-plugins/worker/package.json index 7bcc1eb..af13050 100644 --- a/rust-plugins/worker/package.json +++ b/rust-plugins/worker/package.json @@ -1,6 +1,6 @@ { "name": "@farmfe/plugin-worker", - "version": "2.0.0-beta.0", + "version": "2.0.0-beta.1", "main": "scripts/index.js", "types": "scripts/index.d.ts", "type": "module", diff --git a/rust-plugins/worker/src/lib.rs b/rust-plugins/worker/src/lib.rs index 35ca259..449e849 100644 --- a/rust-plugins/worker/src/lib.rs +++ b/rust-plugins/worker/src/lib.rs @@ -8,8 +8,8 @@ use farmfe_compiler::Compiler; use farmfe_core::{ cache_item, config::{ - persistent_cache::PersistentCacheConfig, - Config, ModuleFormat, ModuleFormatConfig, OutputConfig, TargetEnv, + persistent_cache::PersistentCacheConfig, Config, ModuleFormat, ModuleFormatConfig, + OutputConfig, TargetEnv, }, context::{CompilationContext, EmitFileParams}, deserialize, @@ -76,6 +76,7 @@ fn build_worker( persistent_cache: Box::new(PersistentCacheConfig::Bool(false)), output: Box::new(OutputConfig { target_env: TargetEnv::Library, + entry_filename: full_file_name.clone(), ..*compiler_config.output.clone() }), lazy_compilation: false, @@ -87,8 +88,7 @@ fn build_worker( .unwrap(); compiler.compile().unwrap(); let resources_map = compiler.context().resources_map.lock(); - let resource_name = format!("{}.mjs", full_file_name); - let resource = resources_map.get(&resource_name).unwrap(); + let resource = resources_map.get(&full_file_name).unwrap(); let content_bytes = resource.bytes.clone(); content_bytes }