找不到Reactjs模块:错误无法解析文件或目录

时间:2017-03-10 12:48:58

标签: reactjs webpack gulp react-dom

为什么我的gulp:当我尝试运行它时,编译开发似乎正在碰壁?

我试过通过玩webpack.json和package.json来解决它,但到目前为止我无法解决这个问题。

我是否通过重新配置webpack和package.json来寻找正确的方向,或者更多的是在node_modules / react / lib文件夹中存在ReactMount.js文件的问题。

[20:41:27] Starting 'compile:development'...
[20:41:27] Starting 'clean:dist'...
[20:41:27] Finished 'compile:development' after 7.8 ms
[20:41:27] Finished 'clean:dist' after 33 ms
[20:41:27] Starting 'stylus:development'...
[20:41:27] Finished 'stylus:development' after 343 ms
[20:41:27] Starting 'sass:development'...
[20:41:27] Finished 'sass:development' after 9.23 ms
[20:41:27] Starting 'babel'...
[20:41:29] Finished 'babel' after 1.4 s
[20:41:29] Starting 'webpack:development'...
[20:41:31] Plumber found unhandled error:
Error in plugin 'webpack-stream'
Message:
    ./~/react-dom/lib/ReactMount.js
Module not found: Error: Cannot resolve 'file' or 'directory' 

我还提供了我的webpack.development.js进行验证

const webpack = require("webpack");
const path = require("path");

const build_location = '../dist';
const vendor_location = '../lib/';

module.exports = {
entry: {
    app: build_location + "/build/app",
    vendor: [
    ]
},
output: {
    path: path.resolve(build_location + "/static/js"),
    filename: "bundle.js"
},
resolve: {
    alias: {
        'jquery': path.resolve(vendor_location + "jquery-3.1.1.min.js"),
        'react': require.resolve('react'),
        'react-dom': require.resolve('react-dom'),
        'react-redux': require.resolve('react-redux'),
        'redux': require.resolve('redux'),
        'react-router': require.resolve('react-router'),
        'sweetalert': require.resolve('sweetalert')
    }
},
plugins: [
    new webpack.DefinePlugin({
        "process.env": {
            "NODE_ENV": JSON.stringify("development")
        }
    }),
    new webpack.ProvidePlugin({
        $: path.resolve(vendor_location + "jquery-3.1.1.min.js"),
        jQuery: path.resolve(vendor_location + "jquery-3.1.1.min.js")
    }),
    new webpack.optimize.CommonsChunkPlugin("vendor", "vendor.bundle.js"),
],
externals: {
    Config: JSON.stringify(require("./config.development.json"))
    }
}
    stats: {
errorDetails: true,
colors: true,
errors: true,
errorDetails: false,
warnings: false
}
}

以下是图片形式的错误详情。

Error Details

0 个答案:

没有答案