Skip to content

Commit

Permalink
fix: use platform-specific path separator (#647)
Browse files Browse the repository at this point in the history
  • Loading branch information
zamotany authored Sep 23, 2019
1 parent a7b0864 commit 3626cce
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/haul-babel-preset-react-native/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import path from 'path';

const defaultPlugins = [
[require('@babel/plugin-proposal-class-properties'), { loose: true }],
[require('@babel/plugin-proposal-optional-catch-binding')],
Expand Down Expand Up @@ -28,6 +30,10 @@ function isTSXSource(fileName: string) {
return !!fileName && fileName.endsWith('.tsx');
}

function isReactNative(fileName: string) {
return !!fileName && fileName.includes(`node_modules${path.sep}react-native`);
}

export default function getHaulBabelPreset(
api: any,
options: { hermes: boolean }
Expand All @@ -54,7 +60,7 @@ export default function getHaulBabelPreset(
],
},
{
test: /node_modules\/react-native/,
test: isReactNative,
plugins: [
[
require('@babel/plugin-transform-modules-commonjs'),
Expand Down

0 comments on commit 3626cce

Please sign in to comment.