Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/26.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js 反应';s未捕获错误:在使用Web包生成后添加ComponentAsRefTo_Node.js_Reactjs_Gulp_Webpack - Fatal编程技术网

Node.js 反应';s未捕获错误:在使用Web包生成后添加ComponentAsRefTo

Node.js 反应';s未捕获错误:在使用Web包生成后添加ComponentAsRefTo,node.js,reactjs,gulp,webpack,Node.js,Reactjs,Gulp,Webpack,我正在尝试构建此包: (版本v0.10.1) 使用webpack并将其用于我的模块: 节点v6.1.0 npm v3.8.6 构建策略: 从github获取存储库 npm安装 npm运行构建 内部/节点\模块/ 没有做什么特别的事 但在尝试使用这个模块后,我得到了这些案例 情况是,如果我使用以下内容构建: searchkit/src/core/react/SearchkitProvider.tsx import * as React from "react"; import {Searchk

我正在尝试构建此包: (版本v0.10.1)

使用webpack并将其用于我的模块:

  • 节点v6.1.0
  • npm v3.8.6
构建策略:

  • 从github获取存储库
  • npm安装
  • npm运行构建
  • 内部/节点\模块/

    没有做什么特别的事

    但在尝试使用这个模块后,我得到了这些案例

    情况是,如果我使用以下内容构建: searchkit/src/core/react/SearchkitProvider.tsx

    import * as React from "react";
    import {SearchkitManager} from "../SearchkitManager"
    
    export interface SearchkitProps {
        searchkit:SearchkitManager
        children?:any
    }
    
    export class SearchkitProvider extends React.Component<SearchkitProps,any> {
    
        static childContextTypes = {
            searchkit:React.PropTypes.instanceOf(SearchkitManager)
        }
    
        static propTypes = {
            searchkit:React.PropTypes.instanceOf(SearchkitManager).isRequired,
            children:React.PropTypes.element.isRequired
        }
    
        componentWillMount() {
            this.props.searchkit.setupListeners()
        }
    
        componentDidMount(){
            this.props.searchkit.completeRegistration()
        }
    
        componentWillUnmount(){
            this.props.searchkit.unlistenHistory()
        }
    
        getChildContext(){
            return {searchkit:this.props.searchkit}
        }
    
        render(){
            return (
                <div>IT DOES WORK!!</div>
            );
        }
    }
    
    npm ls反应:

    ├── react@0.14.8
    └─┬ UNMET PEER DEPENDENCY searchkit@0.10.1
      └── react@0.14.8
    
    npm ERR! peer dep missing: searchkit@0.9.x, required by searchkit-multiselect@0.0.1
    
    export class SearchkitProvider extends React.Component<SearchkitProps,any> {
    
        (...)
    
        render(){
            return (
                <div><input ref="REF" /></div>
            );
        }
    }
    
    const path = require('path')
    const webpack = require('webpack')
    const ExtractTextPlugin = require('extract-text-webpack-plugin')
    const copyrightBanner = require("fs").readFileSync("./COPYRIGHT", "utf-8")
    const autoprefixer = require('autoprefixer')
    
    module.exports = {
      entry: {
        "ignore":['./theming/index.ts'],
        "bundle":['./src/index.ts']
      },
      output: {
        path: path.join(__dirname, 'release'),
        filename: '[name].js',
        library:["Searchkit"],
        libraryTarget:"umd",
        publicPath: '',
        css: 'theme.css'
      },
      resolve: {
        extensions:[".js", ".ts", ".tsx","", ".webpack.js", ".web.js", ".scss"],
        alias: { react: path.resolve('../react') }
      },
      postcss: function () {
        return [autoprefixer]
      },
      plugins: [
        new webpack.BannerPlugin(copyrightBanner, {entryOnly:true}),
        new webpack.optimize.DedupePlugin(),
        new webpack.optimize.OccurenceOrderPlugin(),
        new ExtractTextPlugin("theme.css", {allChunks:true}),
        new webpack.optimize.UglifyJsPlugin({
          mangle: {
            except: ['require', 'export', '$super']
          },
          compress: {
            warnings: false,
            sequences: true,
            dead_code: true,
            conditionals: true,
            booleans: true,
            unused: true,
            if_return: true,
            join_vars: true,
            drop_console: true
          }
        })
      ],
      externals: {
        "react": "React",
        "react-dom":"ReactDOM"
      },
      module: {
        loaders: [
          {
            test: /\.tsx?$/,
            loaders: ['ts'],
            include: [path.join(__dirname, 'src'),path.join(__dirname, 'theming')]
          },
          {
            test: /\.scss$/,
            loader: ExtractTextPlugin.extract(require.resolve("style-loader"),require.resolve("css-loader")+"!"+require.resolve("postcss-loader")+"!"+require.resolve("sass-loader")),
            include: path.join(__dirname, 'theming')
          },
          {
            test: /\.(jpg|png|svg)$/,
            loaders: [
                'file-loader?name=[path][name].[ext]'
            ],
            include: path.join(__dirname, 'theming')
          }
        ]
      }
    };
    
    ├── react@0.14.8
    └─┬ UNMET PEER DEPENDENCY searchkit@0.10.1
      └── react@0.14.8
    
    npm ERR! peer dep missing: searchkit@0.9.x, required by searchkit-multiselect@0.0.1