From 6e69d209175181941d40a157e717e2e64bb1b562 Mon Sep 17 00:00:00 2001 From: Michel Weststrate Date: Mon, 4 Nov 2019 05:05:17 -0800 Subject: [PATCH] Don't bundle react-native dependencies Summary: Make sure that `.native.js` modules resolutions are _NOT_ prefered over `.js` modules when building flipper or flipper plugins Reviewed By: jknoxville Differential Revision: D18297580 fbshipit-source-id: 73f9114d19eb0934cdf69d9668b582966aedc756 --- scripts/build-utils.js | 2 +- scripts/start-dev-server.js | 2 +- src/reducers/index.tsx | 3 +-- static/compilePlugins.js | 2 +- 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/scripts/build-utils.js b/scripts/build-utils.js index 7a1f1d88e..7e62bc063 100644 --- a/scripts/build-utils.js +++ b/scripts/build-utils.js @@ -66,7 +66,7 @@ function compile(buildFolder, entry) { ), }, resolver: { - blacklistRE: /\/(sonar|flipper-public)\/dist\//, + blacklistRE: /\/(sonar|flipper-public)\/dist\/|(\.native\.js$)/, }, }, { diff --git a/scripts/start-dev-server.js b/scripts/start-dev-server.js index 8f8a46ca3..924d3de72 100644 --- a/scripts/start-dev-server.js +++ b/scripts/start-dev-server.js @@ -67,7 +67,7 @@ function startMetroServer(app) { ), }, resolver: { - blacklistRE: /\/(sonar|flipper)\/dist\//, + blacklistRE: /\/(sonar|flipper)\/dist\/|(\.native\.js$)/, }, watch: true, }).then(metroBundlerServer => { diff --git a/src/reducers/index.tsx b/src/reducers/index.tsx index 31485b799..9ed622f12 100644 --- a/src/reducers/index.tsx +++ b/src/reducers/index.tsx @@ -45,8 +45,7 @@ import {persistReducer} from 'redux-persist'; import {PersistPartial} from 'redux-persist/es/persistReducer'; import {Store as ReduxStore, MiddlewareAPI as ReduxMiddlewareAPI} from 'redux'; -// @ts-ignore: explicitly need to import index.js, otherwise index.native.js is imported, because redux-persist assumes we are react-native, because we are using metro-bundler -import storage from 'redux-persist/lib/storage/index.js'; +import storage from 'redux-persist/lib/storage'; export type Actions = | ApplicationAction diff --git a/static/compilePlugins.js b/static/compilePlugins.js index af34a3866..1e03a1ed8 100644 --- a/static/compilePlugins.js +++ b/static/compilePlugins.js @@ -210,7 +210,7 @@ async function compilePlugin( }, resolver: { sourceExts: ['tsx', 'ts', 'js'], - blacklistRE: /\/(sonar|flipper-public)\/dist\//, + blacklistRE: /\/(sonar|flipper-public)\/dist\/|(\.native\.js$)/, }, }, {