adonuxt-template icon indicating copy to clipboard operation
adonuxt-template copied to clipboard

Split client and server builds?

Open jamesAtcodeninja opened this issue 8 years ago • 13 comments

Every time a change is made to the /app the entire project rebuilds, which is taking a considerable amount of time. Is there a way to split the code so that client changes, and server changes are built differently?

This feature request is available on Nuxt.js community (#c44)

jamesAtcodeninja avatar Jun 28 '17 01:06 jamesAtcodeninja

Are you referring to when you are in development and running a server with live reloading?

jzucadi avatar Jun 28 '17 04:06 jzucadi

Yes, the live reload on the server by nodemon forces everything to reload.

jamesAtcodeninja avatar Jun 28 '17 09:06 jamesAtcodeninja

The watchers property lets you overwrite watchers configuration in your nuxt.config.js.

watchers: { webpack: { aggregateTimeout: 300, poll: 1000 } }

You can override webpacks defaults settings but you will need to comb through here first: https://webpack.js.org/configuration/watch/#watchoptions

jzucadi avatar Jun 28 '17 21:06 jzucadi

I'm not really sure if this has to do with nodemon watching the backend code. If you look at the script for dev it has nodemon watching /app, .env, and etc. The NuxtController that's within the /app folder triggers webpack to reload as well. But please tell me if my understanding is wrong.

jamesAtcodeninja avatar Jun 28 '17 23:06 jamesAtcodeninja

Honestly, I'm not sure. I just went through the nuxt docs and the only section on watchers said what I posted above

jzucadi avatar Jun 29 '17 00:06 jzucadi

Has anyone found solution for this ? I have searched and multiple times, can't find solution.

alanaasmaa avatar Nov 19 '17 13:11 alanaasmaa

@alanaasmaa I have found a partial solution too this. I got it too work that when you change an app file or a non-nuxt file, nuxt doesn't rebuild when visiting a non-nuxt route. If you visit a nuxt route after changing a non-nuxt file then nuxt will have to rebuild, there is no way around this since the server is restarted the Nuxt instance will be destroyed and has to be rebuilt. In my solution, you do get the extra benefit of being able to use adonis serve --dev again. I only can't get HMR to work yet. as soon as I finish that and write some tests I will submit a pr or post the solution here. Hopefully today, otherwise next week :)

jellebreuer avatar Feb 09 '18 15:02 jellebreuer

@alanaasmaa got a PR up, if you want to try it now you can do: adonis new --blueprint jbreuer95/adonuxt-template <project-name> Let me know if it works out :)

jellebreuer avatar Feb 09 '18 20:02 jellebreuer

@jbreuer95 awesome !! I will try it as soon i get home ! Very good job ! If it works i will buy you a beer :)

alanaasmaa avatar Feb 09 '18 21:02 alanaasmaa

@jbreuer95 Awesome!

I've had same issue while testing a project based on this template using vow-browser & your fork safe my day. Thanks so much!

@alanaasmaa owe you a beer btw 😉

feryardiant avatar Feb 18 '18 15:02 feryardiant

@alanaasmaa got a PR up, if you want to try it now you can do: adonis new --blueprint jbreuer95/adonuxt-template <project-name> Let me know if it works out :)

@jbreuer95 how were you able to achieve this? your repo has been deleted :( April 2020, this issue is still annoying, I can't believe that ppl are ok with combined builds for server side changes. Do you by any chance still have your code or can you suggest what needs to be changed?

czco avatar Apr 17 '20 13:04 czco

After almost 3 years, this issue is still annoying. Are we the only people on the earth who care about the time spending for builds?

omidamraei avatar Jun 14 '20 16:06 omidamraei

@jbreuer95 how were you able to achieve this? your repo has been deleted :( April 2020, this issue is still annoying, I can't believe that ppl are ok with combined builds for server side changes. Do you by any chance still have your code or can you suggest what needs to be changed?

https://github.com/nuxt-community/adonuxt-template/pull/86

jellebreuer avatar Dec 17 '20 14:12 jellebreuer