require('dotenv').config({ path: path.resolve( __dirname, '../../.env' ) });
module.exports = {
...
plugins: [
new HtmlWebpackPlugin( { template: './src/index.html' } ),
new webpack.DefinePlugin( {
"process.env": JSON.stringify(process.env)
} ),
],
...
};
/**
Now in html file use <%= process.env.GTAG_ID %>
*/