1.2.3 • Published 1 year ago

vite-runtime-env-script-plugin v1.2.3

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

vite-runtime-env-script-plugin

A plugin created to simplify the deployment process: there is no need to build a docker image every time you change environment variables.

Installation

yarn add vite-runtime-env-script-plugin
npm install vite-runtime-env-script-plugin

Usage

Add runtimeEnvScript plugin to vite.config.js / vite.config.ts and provide a list of environment variable names:

// vite.config.js / vite.config.ts
import { runtimeEnvScript } from "vite-runtime-env-script-plugin";

export default {
  plugins: [runtimeEnvScript({ variables: ["BASE_URL"] })],
};

To access the environment variables use the built-in getter:

import { getRuntimeEnv } from "vite-runtime-env-script-plugin/getRuntimeEnv";

const baseURL = getRuntimeEnv("BASE_URL");

Dockerfile

CMD ["/bin/sh", "-c", "envsubst < /usr/share/nginx/html/template-runtime-env.js > /usr/share/nginx/html/runtime-env.js && nginx -g \"daemon off;\""]
1.2.3

1 year ago

1.2.2

1 year ago

1.2.1

1 year ago

1.2.0

1 year ago

1.1.9

2 years ago

1.1.8

2 years ago

1.1.6

2 years ago

1.1.5

2 years ago

1.1.4

2 years ago

1.1.3

2 years ago

1.1.2

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago