-
-
Notifications
You must be signed in to change notification settings - Fork 173
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: write generate resource and some utils #2081
base: v2-dev
Are you sure you want to change the base?
feat: write generate resource and some utils #2081
Conversation
|
); | ||
} | ||
|
||
self.copy_dir(public_dir_path, output_dir_path); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wdyt to add a plugin driver hook to notify plugins about public resource copy? or just leave the plugins to resolve completed files itself?somtimes some elder projects may need users add some files to public dir so we cannot optimize these files for now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copying publicDir should be our internal behavior of the framework. If the user needs to perform other special operations, they can do so in the finish
hook or the upcoming writeBundle
hook.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After the entire write is completed, we can provide users with a writeBundle hook to manipulate the output file or other files.
@@ -8,7 +8,7 @@ | |||
}, | |||
"scripts": { | |||
"preinstall": "npx only-allow pnpm", | |||
"bootstrap": "node scripts/bootstrap.mjs", | |||
"bootstrap": "node scripts/bootstrap.mjs -v", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think maybe it's better to use pnpm bootstrap -v
instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason why I suggest using verbose is that in some special cases, such as the first run of farm, Rust build can be extremely slow. Many developers cannot see the real Rust compilation progress and come to ask me if it is stuck. This is also why I use inherit to prompt developers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can add another command, but I still feel that verbose is the user's first intuition.
Outputting the output file size in the Rust hook causes the program to wait for all threads to finish executing before proceeding, even though multiple threads have been started. This leads to longer overall compilation times. In JavaScript, we could make this run asynchronously, but I wonder if there are any better solutions; otherwise, we'll have to implement it in JavaScript after all. Wait for all threads to finish execution here. const startTime = performance.now();
await compiler.compile();
const elapsedTime = Math.floor(performance.now() - startTime);
const persistentCacheText = persistentCache
? bold(PersistentCacheBrand)
: ''; |
@@ -165,6 +165,17 @@ export async function resolveConfig( | |||
sortFarmJsPlugins | |||
); | |||
|
|||
if (config.compilation.mode === 'production' && !config.watch) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add a config option like output.fileSize
and move this if statement to rust compiler similar to minify or tree shake.
#1793
add output file print log

add writeBundle
prepare out dir logic move to rust side
add rust side logger
add some toolkit utils