{"id":20105945,"url":"https://github.com/markthree/nitro-port-module","last_synced_at":"2025-11-09T12:03:05.398Z","repository":{"id":220964175,"uuid":"753065167","full_name":"markthree/nitro-port-module","owner":"markthree","description":"Allow changing the nitro default port | 允许改变 nitro 默认 port","archived":false,"fork":false,"pushed_at":"2024-02-23T13:31:03.000Z","size":160,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-04-24T13:44:31.138Z","etag":null,"topics":["module","nitro","nitropack","node","port"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/markthree.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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-02-05T11:59:35.000Z","updated_at":"2024-08-18T09:27:48.043Z","dependencies_parsed_at":"2024-02-22T07:27:49.962Z","dependency_job_id":"0431ac45-fbd3-44c1-bcd3-ed95341bafaf","html_url":"https://github.com/markthree/nitro-port-module","commit_stats":null,"previous_names":["markthree/nitro-port-module"],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markthree%2Fnitro-port-module","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markthree%2Fnitro-port-module/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markthree%2Fnitro-port-module/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markthree%2Fnitro-port-module/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/markthree","download_url":"https://codeload.github.com/markthree/nitro-port-module/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241549089,"owners_count":19980475,"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":["module","nitro","nitropack","node","port"],"created_at":"2024-11-13T17:48:40.252Z","updated_at":"2025-11-09T12:03:00.343Z","avatar_url":"https://github.com/markthree.png","language":"TypeScript","readme":"# nitro-port-module\n\nAllow changing the nitro default port\n\n\u003cbr /\u003e\n\n## README 🦉\n\n[简体中文](./README_CN.md) | English\n\n\u003cbr /\u003e\n\n## Usage\n\n### install\n\n```shell\nnpm i nitro-port-module -D\n```\n\n### Configuration Module\n\n\u003e nuxt\n\n```ts\n// nuxt.config.ts\nimport nitroPort from \"nitro-port-module\";\n\nexport default defineNuxtConfig({\n  nitro: {\n    modules: [\n      nitroPort({\n        port: 4000,\n      }),\n    ],\n  },\n});\n```\n\n\u003e nitro\n\n```ts\n// nitro.config.js\nimport nitroPort from \"nitro-port-module\";\n\nexport default defineNitroConfig({\n  modules: [\n    nitroPort({\n      port: 4000,\n    }),\n  ],\n});\n```\n\n#### polyfill\n\nDefault automatic detection\n\n```ts\n// nuxt.config.ts\nimport nitroPort from \"nitro-port-module\";\n\nexport default defineNuxtConfig({\n  nitro: {\n    modules: [\n      nitroPort({\n        port: 4000,\n        polyfill(nitro, port) {\n          return nitro.options.preset.includes(\"deno\")\n            ? `Deno.env.set(\"PORT\", \"${port}\")`\n            : `process.env.PORT = '${port}'`;\n        },\n      }),\n    ],\n  },\n});\n```\n\n### compatible\n\nIn older versions of Nuxt3, there might not be Nitro modules. In this case, you\ncan try using the following configuration.\n\n```ts\nimport { ViteNitroPort } from \"nitro-port-module\";\n\nexport default defineNuxtConfig({\n  devServer: {\n    port: 5000,\n  },\n  vite: {\n    plugins: [\n      ViteNitroPort({\n        port: 5000,\n      }),\n    ],\n  },\n});\n```\n\n\u003cbr /\u003e\n\n## License\n\nMade with [markthree](https://github.com/markthree)\n\nPublished under [MIT License](./LICENSE).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarkthree%2Fnitro-port-module","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarkthree%2Fnitro-port-module","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarkthree%2Fnitro-port-module/lists"}