2016-05-13 50 views
2

MYAPP:的WebPack不能解析的文件或DIC

| --src

| --index.js

| --content.js

| --webpack.config。 JS

index.js:

const React = require('react'); 
const ReactDom = require('react-dom'); 
const View = require('./content'); 

ReactDom.render(<View/>, document.body); 

content.js:

const React = require('react'); 
class view extends React.Component { 
    render() { 
     return <p> Content </p> 
    } 
} 

module.exports = View; 

webpack.config.js

module.exports = { 
    entry: './src/*', 
    output: { 
    path: path.join(__dirname, '/build'), 
    filename: '[name].bundle.js' 
    }, 
    resolve: { 
    extensions: ['', '.js', '.jsx'] 
    }, 
    module: { 
    loaders: [{ 

     test: /\.js|jsx$/, 
     loader: ['jsx-loader?harmony'], 
     exclude: /node_modules/ 
    }] 
    }, 
    plugins: [commonsPlugin] 
} 

問題:

的WebPack --display-錯誤細節

哈希:c47fe037926d0dc83af7

版本:的WebPack 1.13.0

時間:62ms`

Asset  Size Chunks    Chunk Names 

common.js 191字節0發射] common.js

ERROR in Entry module not found: Error: Cannot resolve 'file' or 'directory' ./src/* in /Users/xx/WebstormProjects/jianwenji-react resolve file /Users/xx/WebstormProjects/jianwenji-react/src/* doesn't exist /Users/xx/WebstormProjects/jianwenji-react/src/*.js doesn't exist /Users/xx/WebstormProjects/jianwenji-react/src/*.jsx doesn't exist 決心目錄 /Users/xx/WebstormProjects/jianwenji-react/src/* doesn't exist (directory default file) /Users/xx/WebstormProjects/jianwenji-react/src/*/package.json doesn't exist (directory description file)

爲什麼的WebPack無法找到該文件?

回答