Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NODE_ENV is always production #119

Closed
Neddz opened this issue Feb 11, 2019 · 3 comments
Closed

NODE_ENV is always production #119

Neddz opened this issue Feb 11, 2019 · 3 comments

Comments

@Neddz
Copy link
Contributor

Neddz commented Feb 11, 2019

Hello! I am having some trouble with the following:

I have been trying to overwrite the NODE_ENV variable with no success.

If I do:
NODE_ENV=development netlify-lambda build <folder>
all the functions inside <folder> will have the process.env.NODE_ENV set to production. I believe this might be because webpack is always run in production mode.

Please let me know if I am doing anything wrong.

Thank you!

@swyxio
Copy link
Contributor

swyxio commented Feb 12, 2019

hi,

yes, the line is here

mode: 'production',

pr welcome if you wanna fix

@azdanov
Copy link

azdanov commented Feb 13, 2019

As a workaround you could define a webpack.functions.js with:

const webpack = require('webpack')

module.exports = {
  plugins: [
    new webpack.EnvironmentPlugin({ NODE_ENV: 'development' }),
  ],
}

And run netlify-lambda --config webpack.functions.js build src/lambda. This way it's possible to load any env variables from CI or Netlify.

@swyxio
Copy link
Contributor

swyxio commented Mar 15, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants