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

Add support for assetPlugins argument to start command #318

Merged
merged 2 commits into from
Apr 16, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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