JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 81122
  • Score
    100M100P100Q176346F
  • License MIT

Environment Variables Compatible

Package Exports

  • vite-plugin-env-compatible

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (vite-plugin-env-compatible) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

vite-plugin-env-compatible

inject to process.env like vue-cli or create-react-app

wakatime NPM Publish downloads npm version License: MIT

Motivation

  • vite expose VITE_XXX to import.meta.env.VITE_XXX, but not loaded to process.env like vue-cli or create-react-app
  • this plugin support setting prefix like VUE_APP_ or REACT_APP_ and loaded to process.env
  • just for compatibility

Usage

yarn add vite-plugin-env-compatible
// vite.config.ts
import envCompatible from 'vite-plugin-env-compatible'

// @see https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    // ...other plugins
    envCompatible(/* options */)
  ],
})

Options

Underlying

  • dotenv & dotenv-expand
  • vite

Further