Webpack react-native-webpack-server导入3d零件库

时间:2015-11-26 21:18:51

标签: react-native webpack

有这个webpack配置我正在使用react-native-webpack-server

var fs = require('fs');
var path = require('path');
var webpack = require('webpack');

var config = {
  debug: true,
  devtool: 'source-map',
  entry: {
    'index.ios': ['./src/main.js'],
  },

  output: {
    path: path.resolve(__dirname, 'build'),
    filename: '[name].js',
  },

  module: {
    loaders: [
      {
        test: /\.js$/,
        exclude: /node_modules/,
        loader: 'babel',
        query: { stage: 0, plugins: ['./build/babelRelayPlugin'] }
      },
    ],
  },

  plugins: [],
};

当我导入

从'react-native-scrollable-tab-view'导入ScrollableTabView;

我得到了

ERROR in ./~/react-native-scrollable-tab-view/index.js
Module parse failed: /Users/butuzgol/Playground/watchme/node_modules/react-native-scrollable-tab-view/index.js Line 135: Unexpected token <
You may need an appropriate loader to handle this file type.
|       return React.cloneElement(this.props.renderTabBar(), props);
|     } else {
|       return <DefaultTabBar {...props} />;
|     }
|   },
 @ ./src/pages/dashboard.js 25:36-79

我也发现了这个问题https://github.com/mjohnston/react-native-webpack-server/issues/34但是现在我还没找到解决方案

1 个答案:

答案 0 :(得分:0)

我在exclude attr

中更新了regexp
exclude: /(?!node_modules\/react-native-scrollable-tab-view)node_modules/,