-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
[bug] App compilation starts before beforeDevCommand complete. #4740
Labels
Comments
aleph1
added
status: needs triage
This issue needs to triage, applied to new issues
type: bug
labels
Jul 22, 2022
Yeah we do that because usually a beforeDevCommand starts the dev server. We could add an option to wait for it to finish. |
That would be much appreciated! |
lucasfernog
added a commit
that referenced
this issue
Aug 2, 2022
13 tasks
lucasfernog
added a commit
that referenced
this issue
Aug 2, 2022
No, this will be part of 1.1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Describe the bug
Unlike the beforeBuildCommand, the beforeDevCommand does not seem to wait for the command to finish executing before compiling the application.
Reproduction
In tauri.conf.json, set the following settings:
"beforeBuildCommand": "sleep 5 && npm run build",
"beforeDevCommand": "sleep 5 && npm run dev",
In package.json add the followings scripts:
"build": "node scripts/build.js",
"dev": "node scripts/build.js",
In scripts/build.js add the following code:
Execute the command npm
run tauri build
, the log output will be in the expected order:Running beforeBuildCommand
sleep 5 && npm run build
js build script start
js build script end
Finished release [optimized] target(s) in 0.21s
Bundling…
Execute the command npm
run tauri dev
, and the log output will not be in the expected order:Running BeforeDevCommand (
sleep 5 && npm run dev
)Info Watching [deleted path]
Compiling app v0.1.0 [deleted path]
Finished dev [unoptimized + debuginfo] target(s) in 2.39s
Neither the sleep 5 or the sleep call in the JS function are respected and the console.log calls from scripts/build.js is never logged.
Expected behavior
The beforeDevCommand should function like the beforeBuildCommand with compiling only occurring after the command(s) are complete. This is especially crucial in cases where assets are optimized and copied to a separate "dev" directory, as Tauri is bundling the previous versions of the assets from the "dev" directory.
I can workaround this by having npm run build be something like
node scripts/build.mjs && npm run tauri dev
but it seems counterintuitive and nullifies the use of Tauri's beforeDevCommand functionality.Platform and versions
Stack trace
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: