angular-bazel-example icon indicating copy to clipboard operation
angular-bazel-example copied to clipboard

Combining Bazel for dev and Webpack for prod

Open mathpaquette opened this issue 7 years ago • 6 comments

Guys, I tried Bazel several months ago and I was shocked how Bazel is improving the development flow. I can't wait anymore to use it in every Angular projects. I didn't get into all the details but I'm wondering if we can easily combined both approaches meaning Bazel for dev and using Webpack to package the app in prod since the feature still in experimental mode.

Please enlighten me on that.

Thanks

mathpaquette avatar Apr 06 '19 14:04 mathpaquette

@alexeagle could you please help with that? thanks in advance!

mathpaquette avatar Apr 06 '19 18:04 mathpaquette

As soon as https://github.com/bazelbuild/rules_nodejs/pull/577 lands, you just replace rollup_bundle with webpack_bundle in this example. That's just the first step though. Then we have to have parity with your current use cases. I fear that many ppl don't even know all the things they rely on webpack to do. We might need an incremental migration story where you bring your existing webpack config and we modify it.

alexeagle avatar Apr 08 '19 16:04 alexeagle

okay see https://github.com/bazelbuild/rules_nodejs/tree/master/e2e/webpack for an example of using the webpack rule - add a devDependency on @bazel/labs and then you should be able to load the webpack_bundle rule

alexeagle avatar Apr 11 '19 00:04 alexeagle

@alexeagle thank you so much. I will give a look for sure!

mathpaquette avatar Apr 11 '19 11:04 mathpaquette

@alexeagle Is it possible to add the webpack_bundle to this example? The Bazel build is 200MB big without any index.html. Would be great when we have a working build in order to deploy it on webserver like Nginx.

funnyfrish avatar Jul 04 '19 09:07 funnyfrish

webpack_bundle rule is in rules_nodejs - I'm not sure it matters for the angular example which bundler we use though.

Making the bundle smaller is a separate issue. It should be small under rollup too.

I'm moving the example to bazelbuild/rules_nodejs so closing this one.

alexeagle avatar Sep 12 '19 20:09 alexeagle