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 set to development on test.js config file #1996

Closed
pdfrod opened this issue Mar 11, 2019 · 5 comments
Closed

NODE_ENV set to development on test.js config file #1996

pdfrod opened this issue Mar 11, 2019 · 5 comments

Comments

@pdfrod
Copy link

pdfrod commented Mar 11, 2019

The file webpacker/lib/install/config/webpack/test.js is setting the environment to development. Shouldn't it be test?

@leonid-shevtsov
Copy link
Contributor

leonid-shevtsov commented Mar 22, 2019

I am concerned about this as well. Trying to get process.env.NODE_ENV to be test in my Capybara tests and the straightforward methods aren't working.

@PascalPixel
Copy link

PascalPixel commented May 20, 2019

Same issue here, had to set it to test to get capybara to pass (cors stuff)

// test.js

process.env.NODE_ENV = process.env.NODE_ENV || 'test'

const environment = require('./environment')
const config = environment.toWebpackConfig()

module.exports = config

@swrobel
Copy link
Contributor

swrobel commented Nov 11, 2019

I was looking for the same, and it seems that node handles environments differently than Rails. There's discussion here, but the key quote is:

Webpack and node libraries only understands development and production environments.

@guillaumebriday
Copy link
Member

Can this issue be closed ?

@Kukunin
Copy link

Kukunin commented Jul 8, 2021

process.env.RAILS_ENV is available in my webpacker assets so I use it in my capybara tests.

Rails 6.1.3.2
webpacker 6.0.0.beta.7

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

7 participants