mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-05-07 13:05:18 +08:00
Make Packager send fresh modules through HMR interface
Reviewed By: frantic Differential Revision: D2787951 fb-gh-sync-id: 63c04710b60d99b5161ef9a40b116ba2f72df745
This commit is contained in:
committed by
facebook-github-bot-6
parent
90781d3067
commit
ac9c3c548d
22
packager/react-packager/src/Server/index.js
vendored
22
packager/react-packager/src/Server/index.js
vendored
@@ -112,6 +112,17 @@ const bundleOpts = declareOpts({
|
||||
}
|
||||
});
|
||||
|
||||
const hmrBundleOpts = declareOpts({
|
||||
entryFile: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
},
|
||||
platform: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
},
|
||||
});
|
||||
|
||||
const dependencyOpts = declareOpts({
|
||||
platform: {
|
||||
type: 'string',
|
||||
@@ -220,6 +231,17 @@ class Server {
|
||||
return this.buildBundle(options);
|
||||
}
|
||||
|
||||
buildBundleForHMR(options) {
|
||||
return Promise.resolve().then(() => {
|
||||
if (!options.platform) {
|
||||
options.platform = getPlatformExtension(options.entryFile);
|
||||
}
|
||||
|
||||
const opts = hmrBundleOpts(options);
|
||||
return this._bundler.bundleForHMR(opts);
|
||||
});
|
||||
}
|
||||
|
||||
getDependencies(options) {
|
||||
return Promise.resolve().then(() => {
|
||||
if (!options.platform) {
|
||||
|
||||
Reference in New Issue
Block a user