Skip to content

resolve.alias #75

@jacobrosenthal

Description

@jacobrosenthal

Im using a resolve.alias to swap node module noble for my react native shim react-native-ble

from my webpack.config.js:

  resolve: {
    extensions: ['', '.js', '.jsx', '.es6', '.json'],
    alias: {
      noble: 'react-native-ble'
    }
  },

And here is my index.ios.js:

'use strict';

var React = require('react-native');
var {
  AppRegistry,
  View
} = React;

var noble = require('noble');
console.log(noble);

var bleqr = React.createClass({

  render: function() {
    return (
      <View></View>
    );
  }
});

AppRegistry.registerComponent('bleqr', () => bleqr);

I get a few failures messages, and then the code runs clearly having utilize the alias, though the app then crashes:

2015-09-19 23:08:13.037 [error][tid:com.facebook.React.JavaScript] 'Error: Requiring unknown module "noble". If you are sure the module is there, try restarting the packager.\n stack: \n  <unknown>  index.ios.bundle:1407\n  require    index.ios.bundle:254\n  require    index.ios.bundle:200\n  <unknown>  index.ios.bundle:51855\n URL: http://172.20.10.3:8080/index.ios.bundle\n line: 213\n message: Requiring unknown module "noble". If you are sure the module is there, try restarting the packager.'
2015-09-19 23:08:13.067 [info][tid:com.facebook.React.JavaScript] { state: 'unknown',
  _bindings: 
   { _peripherals: {},
     startScanning: [Function],
     stopScanning: [Function],
     connect: [Function],
     disconnect: [Function],
     updateRssi: [Function],
     discoverServices: [Function],
     discoverIncludedServices: [Function],
     discoverCharacteristics: [Function],
     read: [Function],
     write: [Function],
     broadcast: [Function],
     notify: [Function],
     discoverDescriptors: [Function],
     readValue: [Function],
     writeValue: [Function],
     readHandle: [Function],
     writeHandle: [Function],
     _events: 
      { stateChange: [Function],
        scanStart: [Function],
        scanStop: [Function],
        discover: [Function] } },
  _peripherals: {},
  _services: {},
  _characteristics: {},
  _descriptors: {} }
2015-09-19 23:08:13.347 [info][tid:com.facebook.React.JavaScript] 'Running application "bleqr" with appParams: {"rootTag":1,"initialProps":{}}. __DEV__ === true, development-level warning are ON, performance optimizations are OFF'
2015-09-19 23:08:13.388 [warn][tid:com.facebook.React.JavaScript] 'devtools socket errored', [Error: The operation couldn’t be completed. Connection refused]

Any thoughts?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions