jescalan / roots

a toolkit for rapid advanced front-end development
http://roots.netlify.com/
Other
1.45k stars 132 forks source link

Roots watch uses app.production.coffee #801

Closed Quintisimo closed 6 years ago

Quintisimo commented 6 years ago

When i run roots watch roots uses app.production.coffee instead of app.coffee. Isn't it suppose to use app.coffee by default?

jescalan commented 6 years ago

Yep, there are tests in place to ensure this behavior, and they are passing to my knowledge. If you can make a small project that reproduces this issue it would help!

Quintisimo commented 6 years ago

https://github.com/Quintisimo/HiQ This is one of the projects where I'm using roots

jescalan commented 6 years ago

I just pulled that project down and compiled it, and it did not use the production config. This can be verified by adding a console.log to the production config file, and running roots compile. If the console log doesn't appear, it's not using that config.

Are you 100% sure the production config is being used in your case? What steps have you taken to verify that this is the case? And what operating system are you on?

Quintisimo commented 6 years ago

I did the verified this by removing the roots-records declaration from the app.production.coffee but left it in the app.coffee and then ran roots watch. The site did not compile which told me that the app.coffee file was not being used. I also tried the console.log and it gave me the same result. How do i force roots to use the app.coffee file when I run roots watch? Also I am on Windows 10

jescalan commented 6 years ago

So I am unable to reproduce this issue, I'm sorry! That being said, I ran this on a mac, not windows, so that might be related to the issue. Unfortunately I do own a windows machine, and also not have the time to look into this any further for you right now. However, if you want to look into it that would be great!

The point where the config pull happens in the source code is right here. It's written to be as clear as possible, and is heavily commented.

Quintisimo commented 6 years ago

I think I figured it out. Node is setting the default environment to production and that is why it is using app.production.coffee. If I set the environment to development and then run roots it uses app.coffee. I just need to set the node environment to development by default

jescalan commented 6 years ago

Nice, glad you got it! 🙌 Good detective work.