thgh / vercel-sapper

Vercel builder for Sapper with SSR enabled
MIT License
189 stars 25 forks source link

Builder removes the `NODE_ENV` variable #22

Closed antony closed 4 years ago

antony commented 4 years ago

Weird one as it only just started to occur, but here's a minimal repro:

now.json

{
  "version": 2,
  "name": "now-env-test",
  "build": {
    "env": {
      "NPM_TOKEN": "@npm-token",
      "NODE_ENV": "hello",
      "OTHER_VAR": "world"
    }
  },
  "builds": [
    { "src": "package.json", "use": "now-sapper" }
  ]
}

package.json

{
  "name": "now-env-test",
  "version": "1.0.0",
  "description": "fff",
  "main": "index.js",
  "scripts": {
    "build": "echo Build: $NODE_ENV $OTHER_VAR",
    "now-build": "echo Build: $NODE_ENV $OTHER_VAR"
  },
  "author": "",
  "license": "ISC"
}

index.js

module.exports = (req, res) => {
  res.end(`Hello from Node.js on Now 2.0!`);
};

If you deploy this project, the build output is simply "world" instead of "hello world"

antony commented 4 years ago

After working through the issue with Zeit - turns out it was https://github.com/zeit/now/pull/3862

Closing :tada: