2017-03-27 42 views
0

你好,我跑我的WebPack時(任務運行)反應。在輸入模塊錯誤未找到 - Visual Studio的RC 2017年

Run - development img

請注意,我已經安裝了故宮也

這裏有一個問題我的WebPack

"use strict"; 

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

module.exports = { 
    context: path.join(__dirname, 'wwwroot/js'), 
    entry: { 

     client: './client.js' 
    }, 




    output: { 
     path: path.join(__dirname, 'wwwroot/build'), 
     filename: '[name].bundle.js' 
    }, 
    resolveLoader: { 
     root: path.join(__dirname, 'node_modules') 
    }, 
    module: { 
     loaders: [ 
      // Transform JSX in .jsx files 
      //{ test: /\.jsx$/, loader: 'jsx-loader?harmony' }, 
      { 
       test: /\.jsx$/, 
       exclude: /node_modules/, 
       loader: "babel-loader", 
       query: { 
        presets: ['es2015', 'react'], 
       } 

      }, 
      { 
       test: /\.css$/, 
       loaders: ['style-loader', 'css-loader'] 
      }, 
      { 
       test: /\.(jpg|png|svg)/, 
       loader: "file-loader" 
      } 
     ], 
    }, 
    resolve: { 
     // Allow require('./blah') to require blah.jsx 

     extensions: ['', '.js', '.jsx','json'] 
    }, 
    //externals: { 
    // // Use external version of React (from CDN for client-side, or 
    // // bundled with ReactJS.NET for server-side) 
    // react: 'React' 
    //}, 
    plugins: [ 
     new webpack.DefinePlugin({ 
      'process.env': { 
       'NODE_ENV': JSON.stringify('development') 
      } 
     }) 
    ], 
} 

這裏是我的package.json

<{ 
    "version": "1.0.0", 
    "name": "asp.net", 
    "private": true, 
    "dependencies": { 
    "react": "~15.4.2", 
    "react-dom": "~15.4.2", 
    "react-router": "~4.0.0", 
    "react-image-gallery": "^0.7.15" 
    }, 
    "devDependencies": { 
    "babel-core": "^6.24.0", 
    "babel-loader": "^6.4.1", 
    "babel-preset-env": "^1.2.2", 
    "babel-preset-es2015": "^6.24.0", 
    "babel-preset-react": "^6.23.0", 
    "babel-preset-stage-3": "^6.22.0", 
    "css-loader": "^0.27.3", 
    "expose-loader": "^0.7.3", 
    "file-loader": "^0.10.1", 
    "install": "^0.8.7", 
    "jsx-loader": "^0.13.2", 
    "style-loader": "^0.15.0", 
    "webpack": "1.12.9" 
    } 
} 

這裏是client.js

var Components = require('expose?Components!./components'); 

還我有兩個組成部分,我儘量放在一起,但沒有運氣

這是類StorePicker:

import React from 'react'; 

class StorePicker extends React.Component { 
    render() { 
     // Any where else 
     return <p>Hello</p> 
    } 
} 


export default StorePicker; 

這是索引類,即進口StorePicker

import React from 'react'; 
import ReactDOM from 'react-dom'; 

import './css/style.css'; 

import StorePicker from './components/StorePicker'; 

ReactDOM.render(<StorePicker />, document.getElementById("root")); 
+1

請解釋問題的文字您的問題,並提供[MCVE。 – dash2

回答

0

這可能是因爲斜槓的窗戶上試圖改變

entry: { 

    client: './client.js' 
}, 

entry: { 

    client: path.join(__dirname, './client.js'), 
}, 
+0

謝謝,但仍然有錯誤![輸入模塊錯誤](http://imgur.com/Jz9BZqJ) – Sam

+0

嘗試刪除此行上下文:path.join(__ dirname,'wwwroot/js'), –

+0

我做到了,但沒有解決錯誤 – Sam

相關問題