Provide an optional argument for loadConfigFromFile()
to avoid leaving temporary file in user workspace
#15441
Closed
4 tasks done
Labels
duplicate
This issue or pull request already exists
Description
Although current implementation is already invulnerable to exceptions from the imported userConfig (using finally statememt), it can still leave the temporary file undeleted when user hits CTRL-C on server start (this happens randomly)
See this issue: vuejs/vitepress#3382
Suggested solution
Provide an additional optional parameter to specify where to save the temporary file so downstream frameworks can save temp file to their cache folder.
Example:
Alternative
Instead of writing the file to disk and then importing it back dynamically, transform the code into an IIFE and use
eval()
to run it.Mask SIGINT before import and unmask it in the
finally
block.Additional context
As discussed in the issue (link above), moving bundled file to a different path could mess up relative imports (or requires).
However, it seems like the bundling process always produces a monolithic file without any external dependency (as it is supposed to). My theory is, as long as the process's current working directory doesn't change, nothing should break.
Validations
The text was updated successfully, but these errors were encountered: