【问题标题】:Webpack react-native-webpack-server import 3d part libraryWebpack react-native-webpack-server 导入3d零件库
【发布时间】:2015-11-26 21:18:51
【问题描述】:

有这个 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,但目前我还没有找到解决方案

【问题讨论】:

    标签: react-native webpack


    【解决方案1】:

    我更新了排除属性中的正则表达式

    exclude: /(?!node_modules\/react-native-scrollable-tab-view)node_modules/,
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-04-06
      • 2018-08-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-02-18
      • 2017-02-13
      • 1970-01-01
      相关资源
      最近更新 更多