diff --git a/crates/plugin_partial_bundling/src/lib.rs b/crates/plugin_partial_bundling/src/lib.rs index 9b083801f9..a97ee62a1b 100644 --- a/crates/plugin_partial_bundling/src/lib.rs +++ b/crates/plugin_partial_bundling/src/lib.rs @@ -1,23 +1,19 @@ -#![feature(is_some_and)] - -use std::{collections::VecDeque, path::PathBuf, sync::Arc}; +use std::{collections::VecDeque, sync::Arc}; use farmfe_core::{ - config::{config_regex::ConfigRegex, Config}, + config::Config, context::CompilationContext, - farm_profile_function, farm_profile_scope, - hashbrown::{HashMap, HashSet}, + hashbrown::HashSet, module::{ module_graph::ModuleGraph, module_group::{ModuleGroup, ModuleGroupGraph}, - ModuleId, ModuleType, + ModuleId, }, plugin::{Plugin, PluginHookContext}, - resource::resource_pot::{ResourcePot, ResourcePotType}, + resource::resource_pot::ResourcePot, }; use generate_module_buckets::{generate_module_buckets_map, group_module_buckets_by_module_group}; use generate_resource_pots::generate_resource_pots; -use module_bucket::ModuleBucket; // mod module_bucket; mod generate_module_buckets; diff --git a/crates/plugin_partial_bundling/src/module_bucket.rs b/crates/plugin_partial_bundling/src/module_bucket.rs index 4a97823e1f..6095a024d3 100644 --- a/crates/plugin_partial_bundling/src/module_bucket.rs +++ b/crates/plugin_partial_bundling/src/module_bucket.rs @@ -1,9 +1,6 @@ -use std::mem::replace; - use farmfe_core::{ hashbrown::HashSet, module::{Module, ModuleId, ModuleType}, - resource::resource_pot::ResourcePotId, }; /// A ModuleBucket is a collection of modules whose module_groups field is equal. diff --git a/examples/partial-bundling/farm.config.mjs b/examples/partial-bundling/farm.config.mjs index e61921408a..72e07d190d 100644 --- a/examples/partial-bundling/farm.config.mjs +++ b/examples/partial-bundling/farm.config.mjs @@ -14,7 +14,6 @@ export default { path: 'dist', targetEnv: 'node', format: 'cjs' - // entryFilename: '[entryName].mjs' }, external: [ ...builtinModules.map((m) => `^node:${m}$`), @@ -22,20 +21,24 @@ export default { ], minify: false, presetEnv: false, - sourcemap: false, - lazyCompilation: false, - partialBundling: { - moduleBuckets: [ - { - name: 'common', - test: [], - minSize: 1024, - maxConcurrentRequests: 5 - } - ] - } + sourcemap: false }, server: { hmr: false - } + }, + plugins: [ + // If you comment, you will use the default partial bundling + [ + '@farmfe/plugin-webpack-partial-bundling' + // { + // moduleBucket: [ + // { + // name: 'common', + // test: [], + // // minSize: 1024 + // } + // ] + // } + ] + ] }; diff --git a/examples/partial-bundling/package.json b/examples/partial-bundling/package.json index 5a73a311c3..4f8dcd39fb 100644 --- a/examples/partial-bundling/package.json +++ b/examples/partial-bundling/package.json @@ -10,5 +10,7 @@ "build": "farm build", "postinstall": "node bootstrap.js" }, - "devDependencies": {} + "devDependencies": { + "@farmfe/plugin-webpack-partial-bundling": "workspace:*" + } } \ No newline at end of file diff --git a/js-plugins/vue/farm.config.mjs b/js-plugins/vue/farm.config.mjs index 9ddd094c46..ae4b4a49fc 100644 --- a/js-plugins/vue/farm.config.mjs +++ b/js-plugins/vue/farm.config.mjs @@ -11,8 +11,8 @@ export default { }, output: { path: 'build', - entryFilename: '[entryName].[ext]', - filename: '[resourceName].[ext]', + entryFilename: '[entryName].cjs', + filename: '[resourceName].cjs', targetEnv: 'node', format: 'cjs' }, diff --git a/packages/core/binding/index.d.ts b/packages/core/binding/index.d.ts index 8370097767..ecb98325f9 100644 --- a/packages/core/binding/index.d.ts +++ b/packages/core/binding/index.d.ts @@ -210,16 +210,12 @@ export interface Config { groups?: { name: string; test: string[]; - groupType?: 'mutable' | 'immutable', - resourceType?: 'all' | 'initial' | 'async' + groupType?: 'mutable' | 'immutable'; + resourceType?: 'all' | 'initial' | 'async'; }[]; enforceResources?: { name: string; test: string[]; - reuseExistingResourcePot?: boolean, - maxConcurrentRequests?: number; - minSize?: number; - weight?: number; }[]; enforceTargetConcurrentRequests?: boolean; enforceTargetMinSize?: boolean; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 84a3b33542..6f3e5b9a17 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -390,6 +390,10 @@ importers: '@farmfe/core': specifier: workspace:* version: link:../../packages/core + devDependencies: + '@farmfe/plugin-webpack-partial-bundling': + specifier: workspace:* + version: link:../../rust-plugins/partial-bundling examples/postcss: dependencies: