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

Export getDefaultConfig for custom configurations #167

Merged
merged 1 commit into from
Feb 14, 2019
Merged

Export getDefaultConfig for custom configurations #167

merged 1 commit into from
Feb 14, 2019

Conversation

Salakar
Copy link
Member

@Salakar Salakar commented Feb 13, 2019

Summary:

This PR addresses the first issue described in this comment.

Example usage before CLI was moved:
See https://github.com/ueno-llc/react-native-starter/blob/master/metro.config.js

Example usage after move + this PR:

// metro.config.js
const { resolve } = require('path');
const { mergeConfig } = require('metro-config');
const { getDefaultConfig } = require('@react-native-community/cli/build/util/loadMetroConfig');

const root = __dirname;
const reactNativePath = resolve(root, './node_modules/react-native');

const config = {
  resolver: {
    sourceExts: ['js', 'json', 'ts', 'tsx', 'css', 'scss'],
  },
  transformer: {
    babelTransformerPath: require.resolve('./scripts/transformer.js'),
  },
};

module.exports = mergeConfig(getDefaultConfig({ root, reactNativePath }), config);

Test Plan:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants