n4kz / react-native-indicators

Activity indicator collection for React Native
Other
899 stars 117 forks source link

Does not compile with react-native-web #17

Open fijiwebdesign opened 5 years ago

fijiwebdesign commented 5 years ago

Recreate

create-react-native-app rn-app-web --with-web-support
cd rn-app-web
yarn add react-native-indicators

App.js

import React from 'react';
import { UIActivityIndicator } from 'react-native-indicators'

add the module to webpack.config.js

   const babelLoaderConfiguration = {
  test: /\.js$/,
  // Add every directory that needs to be compiled by Babel during the build.
  include: [
    path.resolve(appDirectory, 'src'),
    path.resolve(appDirectory, 'node_modules/react-navigation'),
    path.resolve(appDirectory, 'node_modules/react-native-tab-view'),
    path.resolve(appDirectory, 'node_modules/react-native-paper'),
    path.resolve(appDirectory, 'node_modules/react-native-vector-icons'),
    path.resolve(appDirectory, 'node_modules/react-native-safe-area-view'),
    path.resolve(appDirectory, 'node_modules/@expo/samples'),
    path.resolve(appDirectory, 'node_modules/@expo/vector-icons'),
    path.resolve(appDirectory, 'node_modules/react-native-platform-touchable'),
    path.resolve(appDirectory, 'node_modules/react-native-pose'),
    path.resolve(appDirectory, 'node_modules/react-native-indicators'),

Then compile

yarn web

Error

ERROR in ./node_modules/react-native-indicators/src/components/indicator/index.js
Module not found: Error: Can't resolve 'react-native/package' in '/Users/chandra/Gabe/Jamie/hectare-app/node_modules/react-native-indicators/src/components/indicator'
 @ ./node_modules/react-native-indicators/src/components/indicator/index.js 1:1998-2029
 @ ./node_modules/react-native-indicators/index.js
 @ ./src/screens/PreLoading.js
 @ ./src/App.js
 @ ./src/index.js
 @ multi (webpack)-dev-server/client?http://localhost:8081 webpack/hot/dev-server ./src/index.js