0.2.2 • Published 5 months ago

nitro-port-module v0.2.2

Weekly downloads
-
License
MIT
Repository
github
Last release
5 months ago

nitro-port-module

Allow changing the nitro default port

README 🦉

简体中文 | English

Usage

install

npm i nitro-port-module -D

Configuration Module

nuxt

// nuxt.config.ts
import nitroPort from "nitro-port-module";

export default defineNuxtConfig({
  nitro: {
    modules: [
      nitroPort({
        port: 4000,
      }),
    ],
  },
});

nitro

// nitro.config.js
import nitroPort from "nitro-port-module";

export default defineNitroConfig({
  modules: [
    nitroPort({
      port: 4000,
    }),
  ],
});

polyfill

Default automatic detection

// nuxt.config.ts
import nitroPort from "nitro-port-module";

export default defineNuxtConfig({
  nitro: {
    modules: [
      nitroPort({
        port: 4000,
        polyfill(nitro, port) {
          return nitro.options.preset.includes("deno")
            ? `Deno.env.set("PORT", "${port}")`
            : `process.env.PORT = '${port}'`;
        },
      }),
    ],
  },
});

compatible

In older versions of Nuxt3, there might not be Nitro modules. In this case, you can try using the following configuration.

import { ViteNitroPort } from "nitro-port-module";

export default defineNuxtConfig({
  devServer: {
    port: 5000,
  },
  vite: {
    plugins: [
      ViteNitroPort({
        port: 5000,
      }),
    ],
  },
});

License

Made with markthree

Published under MIT License.

0.2.2

5 months ago

0.2.1

10 months ago

0.2.0

10 months ago

0.1.0

1 year ago

0.1.2

1 year ago

0.1.1

1 year ago

0.0.5

1 year ago

0.0.4

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago