Skip to content

How to transpile dependencies with babel. #6

@dalcib

Description

@dalcib

@rafeca, thanks for this metro-sample-app.

I'm trying to use it with react-native-web,
I am using the following metro.config.js

module.exports = {
  extraNodeModules: {
    'react-native': 'node_modules/react-native-web'
  }
};

In order to get the extension .web.js to work in dev mode, I also changed the dev.html to:

...
<script src="http://localhost:8082/src/index.bundle?platform=web"></script>

adding ?platform=web at the and of the link.

The problem is when I import some react-native-xxx package, as react-native-vecttor-icons, for example, that is not compiled to ES5, or, for example, use ClassProperties, an error occurs.
In react-native-cli, these modules are transpiled automatically with babel.
Wich configuration should I use to get the same behavior in a web project?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions