I am trying to use react-native and react-native-weback-server.
When I run rnws start
I get a SyntaxError at node_modules/react-native/local-cli/server/util/launchChrome.js:15
function getChromeAppName(): string {
^
SyntaxError: Unexpected token :
Looking at that file, I see the method:
function getChromeAppName(): string {
switch (process.platform) {
case 'darwin':
return 'google chrome';
case 'win32':
return 'chrome';
default:
return 'google-chrome';
}
}
However this does not with my Node version (7.9.0). I don't know what version of Javascript this is valid syntax in and if I'm using the correct babel transpiler.
Here's my NPM dependencies:
"dependencies": {
"babel-core": "^6.24.1",
"babel-loader": "^6.4.1",
"babel-plugin-transform-react-jsx": "^6.24.1",
"babel-preset-es2016": "^6.24.1",
"babel-preset-react": "^6.24.1",
"coffee-loader": "^0.7.3",
"coffee-script": "^1.12.5",
"react": "^15.5.4",
"react-dom": "^15.5.4",
"react-native": "^0.43.3",
"react-native-webpack-server": "^0.9.3",
"webpack": "^2.4.1",
"webpack-dev-server": "^2.4.2"
}
and webpack.config.js
var path = require('path'); var webpack = require('webpack');
module.exports = {
entry: './app.coffee',
output: { filename: 'bundle.js' },
module: {
loaders: [
{
test: /.jsx?$/,
loader: 'babel-loader',
exclude: /node_modules/,
query: {
presets: ['es2016', 'react']
}
},
{
test: /\.coffee$/,
loader: "coffee-loader"
}
]
},
};
via maxple
No comments:
Post a Comment