Ask Your Question
4

What is the process to include multiple babelTransformerPath in metro.config?

asked 2022-03-04 11:00:00 +0000

plato gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2021-05-30 12:00:00 +0000

ladyg gravatar image

To include multiple babelTransformerPath in metro.config, you can do the following:

  1. Create an array of transformer paths:
const transformerPaths = [
  "./transformer1.js",
  "./transformer2.js"
];
  1. Add the transformer paths to the transformer config in your metro.config file:
module.exports = {
  transformer: {
    babelTransformerPath: transformerPaths
  }
};

Note that babelTransformerPath takes an array of transformer paths instead of a single path, hence we pass the entire transformerPaths array as the value for it.

  1. Save the metro.config file and run your Metro bundler.

With this setup, Metro will use all the specified transformer paths in the order they are listed in the transformerPaths array.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2022-03-04 11:00:00 +0000

Seen: 5 times

Last updated: May 30 '21