mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-28 20:25:33 +08:00
Pass in the platform options when loading dependencies
Reviewed By: @jingc Differential Revision: D2488262
This commit is contained in:
committed by
facebook-github-bot-4
parent
9ef24d8cc8
commit
ca007aabb4
26
packager/react-packager/src/Server/index.js
vendored
26
packager/react-packager/src/Server/index.js
vendored
@@ -96,6 +96,21 @@ const bundleOpts = declareOpts({
|
||||
}
|
||||
});
|
||||
|
||||
const dependencyOpts = declareOpts({
|
||||
platform: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
},
|
||||
dev: {
|
||||
type: 'boolean',
|
||||
default: true,
|
||||
},
|
||||
entryFile: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
},
|
||||
});
|
||||
|
||||
class Server {
|
||||
constructor(options) {
|
||||
const opts = validateOpts(options);
|
||||
@@ -174,8 +189,15 @@ class Server {
|
||||
return this.buildBundle(options);
|
||||
}
|
||||
|
||||
getDependencies(main) {
|
||||
return this._bundler.getDependencies(main);
|
||||
getDependencies(options) {
|
||||
return Promise.resolve().then(() => {
|
||||
const opts = dependencyOpts(options);
|
||||
return this._bundler.getDependencies(
|
||||
opts.entryFile,
|
||||
opts.dev,
|
||||
opts.platform,
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
_onFileChange(type, filepath, root) {
|
||||
|
||||
Reference in New Issue
Block a user