React4xp Hot Reload Problem on Mac

Enonic version: 7.11.0
OS: Linux

Is there any way to run React4XP in hot reload?
I mean when I make some changes on React side I don’t need to reload whole project with gradle build.
I just need fast hot reload.

I’m, trying to run continuous build

  1. enonic sandbox start <yourSandBoxName> --dev in one terminal (from anywhere), and
  2. enonic project deploy && gradlew react4xp_components compileXP -t from project root in another terminal. Reply No if it asks you to start the sandbox here.

But I’m getting error:

-bash: gradlew: command not found

I’ve fixed that with replacing gradlew to ./gradlew

enonic project deploy && ./gradlew react4xp_components compileXP -t

but I’m getting following problem

Ok, seem like it’s a java version problem )
I think I need java 11

I’ve updated java to 11 and got the error:
Task ‘react4xp_components’ not found in root project ‘isnareactcms’. Some candidates are: ‘react4xpComponents’.

Are there any ideas how to fix that?

I have found solution by mysellf )

Correct task is react4xpComponents:
enonic project deploy && ./gradlew react4xpComponents compileXP -t

Unfortunately continuous build takes too much time ;( (about 5 - 10 min to update)
It is more faster to redeploy (takes 1 min) it with
enonic project deploy

Heads up, this will all change in the next version of React4xp.

There will only be a single gradle task.

Building components should be quicker as we have swapped babel-loader with swc-loader.

In terms of making incremental build smoother one can use the webpack override file to turn on file-system caching. The first build after clean will be slower, but the next build should be quicker.

1 Like

In terms of hot-loading if you run Enonic XP in dev mode should be able to build without using gradle…

The gradle task “react4xpComponents” runs a npm explore command under the hood.

You can run the same npm explore command to build without using gradle.

1 Like