Added script to make React Native support absolute imports

This commit is contained in:
Harrison Healey 2016-10-07 11:46:40 -04:00
parent 723b32a6e2
commit f0291172ac
4 changed files with 22 additions and 5 deletions

View file

@ -13,6 +13,7 @@
},
"devDependencies": {
"babel-eslint": "7.0.0",
"babel-plugin-resolver": "1.1.0",
"babel-preset-react-native": "1.9.0",
"babel-register": "6.16.3",
"eslint": "3.7.1",
@ -26,13 +27,16 @@
},
"scripts": {
"check": "eslint --ext \".jsx\" --ignore-pattern node_modules --quiet .",
"start": "NODE_PATH=./src node node_modules/react-native/local-cli/cli.js start",
"test": "NODE_PATH=./src mocha --compilers js:babel-register",
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "mocha --compilers js:babel-register",
"postinstall": "remotedev-debugger --hostname localhost --port 5678 --injectserver"
},
"babel": {
"presets": [
"react-native"
],
"plugins": [
["resolver", {"resolveDirs": ["src"]}]
]
}
}

15
rn-cli.config.js Normal file
View file

@ -0,0 +1,15 @@
// Copyright (c) 2016 Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
var path = require('path');
var config = {
getProjectRoots() {
return [
path.resolve(__dirname, '.'),
path.resolve(__dirname, './src')
];
}
};
module.exports = config;

View file

@ -33,8 +33,6 @@ export class Client {
setUrl(url) {
this.url = url;
console.log('aaaaaa ' + this.url);
console.log(this);
}
setAcceptLanguage(locale) {

View file

@ -23,7 +23,7 @@ export default function configureStore(preloadedState) {
if (module.hot) {
// Enable Webpack hot module replacement for reducers
module.hot.accept(() => {
const nextRootReducer = require('reducers/index.js').default; // eslint-disable-line global-require
const nextRootReducer = require('../reducers/index.js').default; // eslint-disable-line global-require
store.replaceReducer(nextRootReducer);
});
}