FredKSchott / create-snowpack-app

The all-in-one app template for Snowpack. [moved]
https://www.snowpack.dev
Other
727 stars 96 forks source link

plugin-dotenv fails when NODE_ENV not defined #105

Closed germanftorres closed 4 years ago

germanftorres commented 4 years ago

Hi,

After upgrading to latest release 2.2.0, snowpack prepare fails in my system.

> snowpack

Error: The NODE_ENV environment variable is required but was not specified.
    at plugin (/home/german/dev/sonica/ClientApp/node_modules/@snowpack/plugin-dotenv/plugin.js:6:11)
    at /home/german/dev/sonica/ClientApp/node_modules/snowpack/dist-node/index.js:4187:50
    at Array.map (<anonymous>)
    at normalizeConfig (/home/german/dev/sonica/ClientApp/node_modules/snowpack/dist-node/index.js:4179:35)
    at loadAndValidateConfig (/home/german/dev/sonica/ClientApp/node_modules/snowpack/dist-node/index.js:4419:10)
    at cli (/home/german/dev/sonica/ClientApp/node_modules/snowpack/dist-node/index.js:4488:13)
    at Object.<anonymous> (/home/german/dev/sonica/ClientApp/node_modules/snowpack/dist-node/index.bin.js:29:1)
    at Module._compile (internal/modules/cjs/loader.js:1200:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1220:10)
    at Module.load (internal/modules/cjs/loader.js:1049:32)
    at Function.Module._load (internal/modules/cjs/loader.js:937:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
    at internal/main/run_main_module.js:17:47

I guess that if not defined, the plugin should default to development instead to throwing an error. Thanks!

FredKSchott commented 4 years ago

Thanks for filing! Fixed in 1b2f90b

In case you didn't see it, you probably don't need to run prepare/snowpack install yourself as of Snowpack v2. Snowpack dev & build both manage your deps for you now without it.