webpack-dotenv-plugin
webpack-dotenv-plugin copied to clipboard
Make sample env file optional
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.
Maybe you can try using mine which does just that: https://github.com/mrsteele/dotenv-webpack
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.