webpack-dotenv-plugin icon indicating copy to clipboard operation
webpack-dotenv-plugin copied to clipboard

Make sample env file optional

Open tayden opened this issue 7 years ago • 2 comments

When using the plugin like this:

// ...
new DotenvPlugin({
  path: './.env',
}),
// ...

with no sample .env file location defined, the plugin throws a no such file or directory, open './.env.default' error. Defining the sample file location fixes the problem.

It would be nice if providing a sample path was optional.

tayden avatar Nov 15 '16 23:11 tayden

Maybe you can try using mine which does just that: https://github.com/mrsteele/dotenv-webpack

mrsteele avatar Nov 22 '16 13:11 mrsteele

Thanks for the suggestion @tayden. The reason a sample.env is required is it uses dotenv-safe as a warning system to alert which keys are required. This is useful to ensure you have all the correct keys set, and finding that earlier than later is a good thing.

At this stage I prefer it to be required, but I'd be happy to make it optional if others feel this might be beneficial.

nwinch avatar Nov 23 '16 05:11 nwinch