Skip to content



Terminal window
npm add @dotenv-run/webpack --save-dev


Create a webpack.config.js configuration file and import the plugin:

import { DotenvRunPlugin } from '@dotenv-run/webpack';
import path from 'path';
const __dirname = path.resolve();
export default {
entry: './src/index.js',
output: {
filename: 'main.js',
path: path.resolve(__dirname, 'dist'),
plugins: [
new DotenvRunPlugin(
{ prefix: 'API', verbose: true, root: '../../..' },

The list of options is the same as the ones supported by @dotenv-run/core. Please refer to the API section for more details.