@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
module.exports = {
plugins: ["module:@import-meta-env/babel"],
};
Adjust the test script in your package.json:
{
"scripts": {
"test": "your-test-script",
"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.