找不到webpack模块

时间:2017-11-24 13:05:39

标签: javascript reactjs webpack

我正在使用webpack 1.13.1

当我想运行webpack时,我收到此错误

Module not found: Error: Cannot resolve 'file' or 'directory' 
/home/tetar/grails-reactjs-master/src/main/js
resolve file
/home/tetar/grails-reactjs-master/src/main/js/undefined doesn't exist
/home/tetar/grails-reactjs-master/src/main/js/undefined.webpack-
loader.js doesn't exist [...]
[/home/tetar/grails-reactjs-master/src/main/js/undefined.js]
@ ./src/main/js/test.js 3:0-21

在我的test.js中,我只有2个测试线

require ('./test.css');
module.exports = "test fail"

并且有我的webpack配置

 var path = require('path');
 var root = path.resolve(__dirname);
 var ExtractTextPlugin = require("extract-text-webpack-plugin");
 var extractCSS = new ExtractTextPlugin('bundle.css');

module.exports = {

 entry: {
    index: ['./src/main/js/index.js']
},
output: {
    path: path.resolve(__dirname, './grails-app/assets/javascripts'),
    publicPath: '/assets/',
    filename: 'bundle.js'
},
module: {
    loaders: [
        {
            test: /\.js$/,
            loader: 'babel',
            exclude: /node_modules/,
            include : root
        },
        {
            test: /\.css$/,
            loaders : extractCSS.extract(['css'])
        }
    ]
  }
};

你知道如何解决这个问题吗?

0 个答案:

没有答案