Skip to content

Commit 5ad4b8e

Browse files
wre232114wumingliang
andauthored
fix(rust-plugins): invalid worker extension (#141)
Co-authored-by: wumingliang <wumingliang.9801@bytedance.com>
1 parent 5bea051 commit 5ad4b8e

5 files changed

Lines changed: 17 additions & 5 deletions

File tree

‎.changeset/late-moles-decide.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@farmfe/plugin-worker": patch
3+
---
4+
5+
Fix invalid worker output extension

‎.changeset/pre.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
"beige-eyes-repeat",
3131
"blue-crabs-fail",
3232
"brown-turkeys-clean",
33+
"late-moles-decide",
3334
"tender-cats-swim"
3435
]
3536
}

‎rust-plugins/worker/CHANGELOG.md‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# @farmfe/plugin-worker
22

3+
## 2.0.0-beta.1
4+
5+
### Patch Changes
6+
7+
- Fix invalid worker output extension
8+
39
## 2.0.0-beta.0
410

511
### Major Changes

‎rust-plugins/worker/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@farmfe/plugin-worker",
3-
"version": "2.0.0-beta.0",
3+
"version": "2.0.0-beta.1",
44
"main": "scripts/index.js",
55
"types": "scripts/index.d.ts",
66
"type": "module",

‎rust-plugins/worker/src/lib.rs‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ use farmfe_compiler::Compiler;
88
use farmfe_core::{
99
cache_item,
1010
config::{
11-
persistent_cache::PersistentCacheConfig,
12-
Config, ModuleFormat, ModuleFormatConfig, OutputConfig, TargetEnv,
11+
persistent_cache::PersistentCacheConfig, Config, ModuleFormat, ModuleFormatConfig,
12+
OutputConfig, TargetEnv,
1313
},
1414
context::{CompilationContext, EmitFileParams},
1515
deserialize,
@@ -76,6 +76,7 @@ fn build_worker(
7676
persistent_cache: Box::new(PersistentCacheConfig::Bool(false)),
7777
output: Box::new(OutputConfig {
7878
target_env: TargetEnv::Library,
79+
entry_filename: full_file_name.clone(),
7980
..*compiler_config.output.clone()
8081
}),
8182
lazy_compilation: false,
@@ -87,8 +88,7 @@ fn build_worker(
8788
.unwrap();
8889
compiler.compile().unwrap();
8990
let resources_map = compiler.context().resources_map.lock();
90-
let resource_name = format!("{}.mjs", full_file_name);
91-
let resource = resources_map.get(&resource_name).unwrap();
91+
let resource = resources_map.get(&full_file_name).unwrap();
9292
let content_bytes = resource.bytes.clone();
9393
content_bytes
9494
}

0 commit comments

Comments
 (0)