Skip to content

Commit

Permalink
Add support for assetPlugins argument to start command (#318)
Browse files Browse the repository at this point in the history
* Add support for assetPlugins argument to start command

* Add assetPlugins arg type
  • Loading branch information
brentvatne authored and grabbou committed Apr 16, 2019
1 parent 708211a commit fb94fef
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
7 changes: 7 additions & 0 deletions packages/cli/src/commands/server/runServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import loadMetroConfig from '../../tools/loadMetroConfig';

export type Args = {|
assetExts?: string[],
assetPlugins?: string[],
cert?: string,
customLogReporterPath?: string,
host?: string,
Expand Down Expand Up @@ -54,6 +55,12 @@ async function runServer(argv: Array<string>, ctx: ConfigT, args: Args) {
reporter,
});

if (args.assetPlugins) {
metroConfig.transformer.assetPlugins = args.assetPlugins.map(plugin =>
require.resolve(plugin),
);
}

const middlewareManager = new MiddlewareManager({
host: args.host,
port: metroConfig.server.port,
Expand Down
6 changes: 6 additions & 0 deletions packages/cli/src/commands/server/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ export default {
'Specify any additional folders to be added to the watch list',
parse: (val: string) => val.split(','),
},
{
command: '--assetPlugins [list]',
description:
'Specify any additional asset plugins to be used by the packager by full filepath',
parse: (val: string) => val.split(','),
},
{
command: '--assetExts [list]',
description:
Expand Down

0 comments on commit fb94fef

Please sign in to comment.