You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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?
The text was updated successfully, but these errors were encountered:
I got things working like this, but I'm not at liberty to release the code yet:
Create an entry point script that puts all react components on a global object
adjust react-component to look for the components on that object; react is not imported by ember at all
webpack builds the entry point as a separate js file
Webpack-hot-middleware added as express middleware in the server file generated by ember g server
the global components can be wrapped with react-imported-component so their JS loads on first use
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:
hook into the deploy pipeline to build webpack and copy the result
make some ember plugin that adds the middleware without having to do ember g server
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?
The text was updated successfully, but these errors were encountered: