Does not wait for process to finish
See original GitHub issueWe have a process that writes a value to a file which is then required by the actual build process like this:
git describe --tags HEAD >.app-version || date --rfc-3339=seconds >.app-version
Then, the “version file” generated as above is require()
d in the application source.
It turns out this plugin does not wait for the command to finish before passing control back to webpack, because today we got an error during the JS build:
ModuleNotFoundError: Module not found: Error: Cannot resolve 'file' or 'directory' ../.app-version in /builds/xxx/src
Here is a more minimal demonstration:
new WebpackShellPlugin({
onBuildStart: [
'sleep 60; touch .myfile'
],
safe: true
})
Then, if you run your build as usual, it will actually finish before the file has been created. This prevents you from require()
ing files generated as such in your webpack project.
I see 2 solutions:
- Use the callback interface provided by Webpack plugin API, or
- Use execSync instead of exec
Issue Analytics
- State:
- Created 7 years ago
- Reactions:19
- Comments:6
Top Results From Across the Web
How to NOT wait for a process to complete in batch script?
Is there a way (or a switch) for it NOT to wait and just spawn the process and continue?
Read more >task that does not wait for process to exit #66840 - GitHub
I wanted to make a task which will build a project and open resulting pdf-file in pdf viewer, for example "tasks": [ {...
Read more >cron job does not wait end of process - Super User
When I execute my script manually from the cli, it work fine waiting the end of each instruction before go to the next...
Read more >Process.WaitForExit Method (System.Diagnostics)
WaitForExit(Int32 ) makes the current thread wait until the associated process terminates. It should be called after all other methods are called on...
Read more >Unchecking "Wait for Process to Complete?" in a Process Call ...
Hi @HeeKeat Foo (Customer), Unchecking "wait for process to complete" instructs the calling process to immediately continue executing other paths in the calling ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I made a fork that allows you to block until the scripts finish execution. please check it out: https://www.npmjs.com/package/webpack-synchronizable-shell-plugin
Just made a pr https://github.com/1337programming/webpack-shell-plugin/pull/50