How to build external modules with .env from proyect



Hi guys! I’m creating external modules for vue apps, i am having a problem to access process.env from this modules because when i want to, process.env is empty.
I,m building this modules with webpack and i wander if i can build this modules dynamically, that the external module take the env vars from .env of the project in which is imported.
I tried with webpack-dotenv without success

const Dotenv = require('dotenv-webpack');

    plugins: [
        new Dotenv( {
      		path: '/home/user/app/.env.local'
	} ),

I don’t know if i am doing right either…


Take a look at this documentation: