ctrlplusb / react-async-component

Resolve components asynchronously, with support for code splitting and advanced server side rendering use cases.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Is it possible to load the async'd components from a custom URL?

acb opened this issue · comments

I'm starting to try to integrate code splitting into my app and I've run into a strange situation.

The url for my page is something like https://www.mydomain.com/page/<id>, but my js bundles are loaded from https://www.mydomain.com/assets/js/bundle.js. When I try to use asyncComponent to split my code up webpack generates the 0.js file just fine, but then it tries to load it from https://www.mydomain.com/page/0.js when I need it to load from the js path, https://www.mydomain.com/assets/js/0.js.

Is there any way to specify the url prefix to load from? Especially important is the ability to load from different domains, as in production we'll be storing our static assets in a cloud provider like S3.

Never mind, this is me not being good at webpack. It isn't an issue with this repo.