Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e67d027

Browse files
Merge pull request #76 from EOSIO/develop
Fix Issue #65: Adding warning if no .env found.
2 parents 04af58f + bab0d20 commit e67d027

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

examples/webpack.config.react.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
const webpack = require('webpack')
22
const HtmlWebpackPlugin = require('html-webpack-plugin')
33
const path = require('path')
4-
const dotenv = require('dotenv').config()
4+
const fs = require('fs')
5+
6+
require('dotenv').config()
57

68
module.exports = {
79
mode: "development",
@@ -46,6 +48,14 @@ module.exports = {
4648
contentBase: path.join(__dirname, 'build')
4749
},
4850
plugins: [
51+
function () {
52+
this.plugin('done', function (stats) {
53+
if (!fs.existsSync('.env')) {
54+
console.error('\n\nERROR: No .env file found... Did you copy default.env to .env?\n\n');
55+
process.exit(1);
56+
}
57+
});
58+
},
4959
new webpack.DefinePlugin({
5060
'EXAMPLE_ENV': {
5161
'CHAIN_ID': JSON.stringify(process.env.CHAIN_ID),

0 commit comments

Comments
 (0)