On using webpack with React.js and possible alternatives


(Patrick Aljord) #1

Webpack is very much liked by the React.js community. However, even though it does deliver and comes with tons of useful modules, I’ve had many people telling me they were a bit overwhelmed by its complexity and initial learning curve. I’ve also read from the React team that the server that comes with React Native could kind of replace webpack, could you elaborate on that and do you plan on releasing something more generic and not so tied to React Native in the future, maybe by extracting the server part?


(Sophie Alpert) #2

The React Native packager is designed to be reusable, but at its current stage it probably isn’t extensible and flexible enough to serve as the bundler for all React apps. There’s also lot that goes into loaders/transforms that would need to be replicated somehow if people want more flexibility than using plain ES6+JSX. We also don’t have the resources right now to support the packager beyond its current state as all the work being done for it is centered around React Native. We also wouldn’t want to force people to use it so we’ll continue to maintain browserify/webpack compatibility regardless.

@petehunt’s webpack-howto is a good resource for getting started with webpack; for anything beyond that, I’ve found Stack Overflow and webpack’s gitter room helpful.


(Henrique Alves) #3

Also on resources the react-webpack-cookbook was very helpful for getting started.


(Zach) #4

That’s why I made reactview, for beginners to view their components. I think that if you’re at the point that you can’t figure out webpack, you probably don’t have a great understanding of building react apps yet either.


(Joe Wood) #5

It might be of interest, I’ve actually replaced webpack with the react-native packager for an existing react-js project for its ‘native fork’. This is quite a small TypeScript project. The TS code is compiled to ES5 JS files with the compiler via an npm command, this kicks in the packager automatically. So far this works OK, and integrating TS into the react-native packager isn’t necessary.


(Dan Abramov) #6

I like that we’re starting to see higher-level tools on top of Webpack. It’s very flexible, but also kind of low-level.