I use ES6 dynamic import to accomplish code splitting in my React App. However, I'd like to auth protect the app, and noticed that when import() goes out to fetch JS chunks or CSS, it gets a 401, as expected. However, when I catch the exception via:
import("Component1").then(
module => this.setState({ module }) ).catch(
err => console.log(err)
);
The error that gets returned via "err" does not contain the HTTP response and status code (401). Is there anyway to trap this? I assume import() has to do fetch() under the covers, which will have access to it.