enjoycoding / vite-plugin-mock-server

A mock server plugin for Vite.
MIT License
58 stars 13 forks source link

Mock server always starts and hangs builds even when not applied to the build #6

Closed steveworkman closed 3 years ago

steveworkman commented 3 years ago

Hello - firstly, thanks for the plugin, it works really well.

Issue - when the mock server configuration is instantiated, it creates the middleware hook that then stops the build process from completing.

The plugin should only instantiate itself when it has actually been applied by the build process, and should probably also only run on "serve"

steveworkman commented 3 years ago

I debugged it and found that the watchMockFiles function was holding the process open, even when the plugin had not been initialised by Vite. Fixed by moving that function into the configureServer hook

octoape commented 3 years ago

@steveworkman Merged pull request, released v1.0.3