Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support bundle files without "index" in the name #358

Merged
merged 1 commit into from Mar 1, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/utils/polyfillEnvironment.js
Expand Up @@ -42,9 +42,15 @@ const scriptURL = require('react-native').NativeModules.SourceCode.scriptURL; //
// or Android device it will be `localhost:<port>` but when using real iOS device
// it will be `<ip>.xip.io:<port>`. Thus the code below ensure we connect and download
// manifest/hot-update from a valid origin.
const match = scriptURL && scriptURL.match(/(^.+)\/index/);
let devServerOrigin = null;

if (scriptURL) {
const [protocol, , origin] = scriptURL.split('/');
devServerOrigin = `${protocol}//${origin}`;
}

global.DEV_SERVER_ORIGIN = devServerOrigin;

global.DEV_SERVER_ORIGIN = match ? match[1] : null;
// Webpack's `publicPath` needs to be overwritten with `DEV_SERVER_ORIGIN` otherwise,
// it would still make requests to (usually) `localhost`.
__webpack_require__.p = `${global.DEV_SERVER_ORIGIN}/`; // eslint-disable-line no-undef