{"id":22428335,"url":"https://github.com/momsfriendlydevco/vite-plugin-nodemon","last_synced_at":"2025-03-27T06:43:37.169Z","repository":{"id":196074306,"uuid":"694461955","full_name":"MomsFriendlyDevCo/vite-plugin-nodemon","owner":"MomsFriendlyDevCo","description":"Run a backend server in a Vite project via Nodemon","archived":false,"fork":false,"pushed_at":"2023-09-21T04:00:31.000Z","size":17,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-25T12:50:56.596Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MomsFriendlyDevCo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-09-21T03:37:26.000Z","updated_at":"2023-09-21T03:53:34.000Z","dependencies_parsed_at":"2023-09-21T08:10:16.274Z","dependency_job_id":null,"html_url":"https://github.com/MomsFriendlyDevCo/vite-plugin-nodemon","commit_stats":null,"previous_names":["momsfriendlydevco/vite-plugin-nodemon"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MomsFriendlyDevCo%2Fvite-plugin-nodemon","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MomsFriendlyDevCo%2Fvite-plugin-nodemon/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MomsFriendlyDevCo%2Fvite-plugin-nodemon/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MomsFriendlyDevCo%2Fvite-plugin-nodemon/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MomsFriendlyDevCo","download_url":"https://codeload.github.com/MomsFriendlyDevCo/vite-plugin-nodemon/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245798538,"owners_count":20673901,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-05T20:14:28.486Z","updated_at":"2025-03-27T06:43:37.149Z","avatar_url":"https://github.com/MomsFriendlyDevCo.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"Vite-Plugin-Nodemon\n===================\nRun a backend server in a Vite project via [Nodemon](https://github.com/remy/nodemon).\n\n\nUsage\n-----\nInstall the plugin as you would any other Vite plugin:\n\nIn `vite.config.js`:\n```javascript\nimport {defineConfig} from 'vite';\n\nexport default defineConfig({\n  plugins: [\n    pluginNodemon({\n      script: './server.js',\n      watch: [\n        '.env',\n        'package.json',\n        'server.js',\n        'src/' + '**' + '/*.js', // Watch all JS files (we split the string up like this because those charcaters together can sometimes upset linters)\n      ],\n      ignore: [\n        'src/main.js', // Ignore the Vite main file\n      ],\n      envInject: { // Inject these environment variables into both Vite + the process\n      },\n      envInjectVite: { // Inject these environment variables into Vite\n        VITE_API_URL_BASE: 'http://localhost:8080',\n      },\n      envInjectProcess: { // Inject these environment variables into the process\n        SERVER_HOST: 'localhost',\n        SERVER_PORT: 8080,\n      },\n    }),\n  ],\n});\n```\n\n\nAPI\n===\nThis NPM exposes a single function which returns a Vite plugin.\n\nThe function takes the following options:\n\n\n| Option             | Type                       | Default | Description                                                                                                      |\n|--------------------|----------------------------|---------|------------------------------------------------------------------------------------------------------------------|\n| `script`           | `String`                   |         | File entrypoint to run as the server                                                                             |\n| `delay=250`        | `Number`                   | `250`   | Delay between restarts when noticing a file change                                                               |\n| `watch`            | `Array\u003cString\u003e` / `String` |         | Array (or single) glob of files to react to                                                                      |\n| `ignore`           | `Array\u003cString\u003e` / `String` |         | (or single) glob of files to ignore                                                                              |\n| `envInject`        | `Object`                   |         | Additional ENV variables to inject into both the outer VITE process + inner process when running in Nodemon mode |\n| `envInjectVite`    | `Object`                   |         | Additional ENV variables to inject into the outer Vite instance when running in Nodemon mode                     |\n| `envInjectProcess` | `Object`                   |         | Additional ENV variables to inject into the inner instance when running in Nodemon mode                          |\n| `onStart`          | `Function`                 |         | Function to run on initial boot. Called as `()`                                                                  |\n| `onRestart`        | `Function`                 |         | Function to run on subsequent restarts. Called as `(filesChanged:Array)`                                         |\n| `onQuit`           | `Function`                 |         | Function to run on Nodemon quit. Called as `()`                                                                  |\n| `onLog`            | `Function`                 |         | Function to run when Nodemon outputs log entries. Called as `(logEntry:Object)`                                  |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmomsfriendlydevco%2Fvite-plugin-nodemon","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmomsfriendlydevco%2Fvite-plugin-nodemon","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmomsfriendlydevco%2Fvite-plugin-nodemon/lists"}