jeudi 18 janvier 2018

Module not found: Error: Can't resolve 'AccessibilityInfo' in 'app/node_modules/react-native/Libraries/react-native'

It looks like at-loader fails to load all the modules required. What can I do make the loader be aware of modules like 'AccessibilityInfo' in react-native?

Eg:

ERROR in ./node_modules/react-native/Libraries/react-native/react-native-implementation.js
Module not found: Error: Can't resolve 'AccessibilityInfo' in 'app/node_modules/react-native/Libraries/react-native'

npm run storybook

$ start-storybook start -p 7007 -c .storybook

info @storybook/react v3.3.9
info
Failed to load ./.env.
info => Loading custom .babelrc
info => Loading custom webpack config (full-control mode).
 26% building modules 136/147 modules 11 active ...-v2/node_modules/es5-shim/es5-shim.js
[at-loader] Using typescript@2.5.3 from typescript and "tsconfig.json" from app/tsconfig.json.

 94% asset optimization
[at-loader] Checking started in a separate process...

[at-loader] Checking finished with 185 errors
webpack built c763d68b78931e9f2589 in 7072ms
Hash: c763d68b78931e9f2589
Version: webpack 3.10.0
Time: 7072ms
                       Asset       Size  Chunks                    Chunk Names
    static/manager.bundle.js    2.63 MB       0  [emitted]  [big]  manager
    static/preview.bundle.js    1.62 MB       1  [emitted]  [big]  preview
static/manager.bundle.js.map    3.22 MB       0  [emitted]         manager
static/preview.bundle.js.map    1.92 MB       1  [emitted]         preview
                  index.html     1.2 kB          [emitted]
                 iframe.html  583 bytes          [emitted]
 [205] ./node_modules/@storybook/react/dist/server/config/polyfills.js 113 bytes {0} {1} [built]
 [517] multi ./node_modules/@storybook/react/dist/server/config/polyfills.js ./node_modules/@storybook/react/dist/server/addons.js ./node_modules/@storybook/react/dist/client/manager/index.js 52 bytes {0} [built]
 [518] ./node_modules/@storybook/react/dist/server/addons.js 105 bytes {0} [built]
 [519] ./node_modules/@storybook/addon-actions/register.js 30 bytes {0} [built]
 [520] ./node_modules/@storybook/addon-links/register.js 30 bytes {0} [built]
 [521] ./node_modules/@storybook/react/dist/client/manager/index.js 404 bytes {0} [built]
 [729] ./node_modules/@storybook/react/dist/client/manager/provider.js 3.31 kB {0} [built]
 [731] multi ./node_modules/@storybook/react/dist/server/config/polyfills.js ./node_modules/@storybook/react/dist/server/config/globals.js (webpack)-hot-middleware/client.js?reload=true ./.storybook/config.js 64 bytes {1} [built]
 [732] ./node_modules/@storybook/react/dist/server/config/globals.js 105 bytes {1} [built]
 [733] (webpack)-hot-middleware/client.js?reload=true 7.35 kB {1} [built]
 [737] ./node_modules/strip-ansi/index.js 161 bytes {1} [built]
 [739] (webpack)-hot-middleware/client-overlay.js 2.21 kB {1} [built]
 [744] (webpack)-hot-middleware/process-update.js 4.33 kB {1} [built]
 [745] ./.storybook/config.js 94 bytes {1} [built]
 [817] ./stories/index.js 925 bytes {1} [built]
    + 807 hidden modules

ERROR in ./node_modules/react-native/Libraries/react-native/react-native-implementation.js
Module not found: Error: Can't resolve 'AccessibilityInfo' in 'app/node_modules/react-native/Libraries/react-native'
 @ ./node_modules/react-native/Libraries/react-native/react-native-implementation.js 19:35-63
 @ ./src/components/Question.tsx
 @ ./stories/index.js
 @ ./.storybook/config.js
 @ multi ./node_modules/@storybook/react/dist/server/config/polyfills.js ./node_modules/@storybook/react/dist/server/config/globals.js (webpack)-hot-middleware/client.js?reload=true ./.storybook/config.js

/src/components/Question.tsx

  1 import * as React from "react"
  2 import { StyleProp, StyleSheet, Text, ViewStyle } from "react-native"
  3 import { colors } from "../styles/colors"
  4 import { fonts } from "../styles/fonts"
  5
  6 export interface IProps {
  7   style?: StyleProp<ViewStyle>
  8   onPress?: () => void
  9 }
 10
 11 const styles = StyleSheet.create({
 12   title: {
 13     color: colors.black,
 14     fontFamily: fonts.bold,
 15     fontSize: 24,
 16     fontWeight: "bold",
 17     marginBottom: 10,
 18     textAlign: "center",
 19   },
 20 })
 21
 22 export const Question: React.SFC<IProps> = ({ style, ...otherProps }) => (
 23   <Text style={ [styles.title, style] }> { otherProps.children } </Text >
 24 )

babelrc

  1 {
  2   "presets": [
  3     "react-native"
  4   ]
  5 }

stories/index.js

  1 import React from 'react';
  2 import { storiesOf } from '@storybook/react';
  3 import { action } from '@storybook/addon-actions';
  4 import Question from '../src/components/Question';
  5
  6 storiesOf('Button', module)
  7   .add('with text', () => (
  8     <Question onClick={action('clicked')}>Hello Button</Question>
  9   ))
 10   .add('with some emoji', () => (
 11     <Question onPress={action('clicked')}>😀  😎  👍  💯 </Question>
 12   ));

Aucun commentaire:

Enregistrer un commentaire