@import-meta-env/babel
This plugin is intended to provide a feature same as @import-meta-env/unplugin specific transformations when running the code in other environments, for example, running tests with a NodeJS based test runner or running @vue/cli@4 which needs to be transformed with babel.
This project use SemVer for versioning. For the versions available, see the tags on this repository.
Quick Start
Install and register the plugin:
$ npm i @import-meta-env/babel
module.exports = {
plugins: [["module:@import-meta-env/babel", { example: ".env.example" }]],
};
Adjust scripts in your package.json or elsewhere:
{
"scripts": {
"test": "jest",
"test": "cross-env S3_BUCKET=YOURS3BUCKET jest"
}
}
See also:
- examples
- @import-meta-env/cli - A binary package is used to inject environment variables into those placeholders.
- @import-meta-env/unplugin - Inject environment variables into the import.meta.env object after building the application instead of statically replacing it during production.
Plugin Options
module.exports = {
plugins: [
[
"module:@import-meta-env/babel",
{
env: ".env.example",
},
],
],
};
interface PluginOptions {
env?: string;
example: string;
shouldInlineEnv?: boolean;
}
License
This project is licensed under the MIT License - see the LICENSE file for details