Reputation: 59495
I'm using react-native-web
and I've come across a couple of projects that do not compile their babel code (react-native-popover and react-native-vector-icons). So I need to compile these node_modules
. I know the babel-preset-react-native
preset exists. Is there any way I can use the babel loader I currently have (see below) and also include another loader for the above mentioned packages? Ideally any node_module
that is prefaced with react-native
would be loaded using babel-preset-react-native
.
{
test: /\.js$/,
exclude: /node_modules/,
loaders: [
'react-hot',
'babel-loader?cacheDirectory=true'
]
},
Upvotes: 1
Views: 4482
Reputation: 1206
Exclude takes a regular expression. You can use something like this to get your desired effect.
exclude: /node_modules\/(?!react-native)/
Upvotes: 4