Open wmertens opened 5 years ago
@wmertens That's actually an interesting idea. If we can do that it will be awesome and highly valuable :)
There are two major potential issues that we need to solve:
I'll try to experiment with the idea. If you have already started some research, please feel free to share your findings. PR is very welcomed!
I got things working like this, but I'm not at liberty to release the code yet:
ember g server
end result: ember dev
also starts a webpack compiler that serves the react components and handles hot reloading.
It works very well, hot reload is pretty instant and doesn't cause Ember to reload. If there are overlapping dependencies between react and ember, they can be grabbed by telling webpack to get the dependency from its global (injected by Ember).
Still to figure out:
ember g server
I'll ask about releasing the code again.
I'm thinking that it would be possible to build the react component(s) with webpack, and have webpack include all the dependencies.
This way, the dependencies for React are tree-shaken and work like normally in the React ecosystem, and any shared dependencies can be marked as external globals in the webpack configuration. Furthermore, it can use the hot reload capabilities of webpack and react-hot-loader.
Disadvantage would be having to run 2 processes to develop.
Does that sound reasonable or am I missing something?