Search code examples
node.jsractivejs

Does Ractive recognize NODE_ENV for its debugging?


I'm using Ractive v0.7.x and I've noticed in chrome console that they suggest to set Ractive.DEBUG = false when deploying in production.

I started going this way:

Ractive.DEBUG = document.location.hostname.match(/^appdev\./);

Still, I'm using webpack and I discovered that React dev uses NODE_ENV variable (like express) to know whether its debug parts should be stripped of the production compiled.

They suggest in Webpack conf to use something like

new webpack.DefinePlugin({
  'process.env': {NODE_ENV: '"production"'}
})

Now, my question is if Ractive recognizes this env variable? it would be very useful for all of us that packs the code with webpack or other 3rd party tool.


Solution

  • No, Ractive doesn't use NODE_ENV. You need to set Ractive.DEBUG. I personally use the same approach as you - setting the value based on the hostname.