Socket
Socket
Sign inDemoInstall

@import-meta-env/babel

Package Overview
Dependencies
147
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @import-meta-env/babel

Load environment variables into import.meta.env object


Version published
Maintainers
1
Created

Readme

Source

@import-meta-env/babel

This plugin is intended to provide an approximation of some of @import-meta-env/vite specific transformations when running the code in other environments, for example, running tests with a NodeJS based test runner.

⚠ The functionality within these transformations should not be relied upon in production.

🚀 Quick Start

Install and register the plugin:

$ npm i dotenv @import-meta-env/babel
// babel.config.js
module.exports = {
  plugins: ["module:@import-meta-env/babel"],
};

Adjust the test script in your package.json:

{
  "scripts": {
    // If you have a `.env` file:
    "test": "your-test-script",
    // If you don't have a `.env` file:
    "test": "cross-env S3_BUCKET=YOURS3BUCKET your-test-script"
  }
}

See also:

  • examples
  • @import-meta-env/vite - Inject environment variables into the import.meta.env object after building the application instead of statically replacing it during production.

FAQs

Last updated on 26 Feb 2022

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc