2017-11-06 8 views
1

私はwebpackの初心者です。現在、私の現在のMVC 4アプリケーション内でVueを設定するために、@Bertによってthisが返答しています。webpackエラー:ASP.Net + Vueアプリケーションのoutput.filenameが必要です

私はwebpack --watchを実行しようとすると、私は次のエラーを取得する:

Error: 'output.filename' is required, either in config file or as --output-filename 
    at processOptions (dir\node_modules\webpack\bin\convert-argv.js:507:11) 
    at processConfiguredOptions (dir\node_modules\webpack\bin\convert-argv.js:150:4) 
    at module.exports (dir\node_modules\webpack\bin\convert-argv.js:112:10) 
    at yargs.parse (dir\node_modules\webpack\bin\webpack.js:171:41) 
    at Object.Yargs.self.parse (dir\node_modules\webpack\node_modules\yargs\yargs.js:533:18) 
    at Object.<anonymous> (dir\node_modules\webpack\bin\webpack.js:152:7) 
    at Module._compile (module.js:635:30) 
    at Object.Module._extensions..js (module.js:646:10) 
    at Module.load (module.js:554:32) 
    at tryModuleLoad (module.js:497:12) 

私webpack.config.jsファイル:

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

// build an object that looks like 
// { 
//  "filename": "./filename.vue" 
// } 
// to list the entry points for webpack to compile. 
function buildEntry() { 
    const reducer = function(entry, file) { entry[file.split(".").shift()] = './Vue/' + file; return entry; }; 

return fs.readdirSync(path.join(__dirname, "Vue")) 
    .filter(function(file) {file.endsWith(".vue")}) 
    .reduce(reducer, {}); 
} 

module.exports = { 
    entry: buildEntry(), 
    output: { 
     path: path.join(__dirname, "Vue"), 
     filename: "[name].js", 
     library: "[name]" 
    }, 
    module: { 
     loaders: [ 
      { test: /\.vue$/, loader: 'vue-loader' }, 
     ] 
    } 
} 

を私はちょうど私はまた、いくつかの後、ES5でES6コードを変更問題に関する既存のSOの回答が該当するものはありませんが、私はここで明らかに何かが不足していると思います。

答えて

1

還元剤がES5に変換されたとき、バグが導入されました。具体

return fs.readdirSync(path.join(__dirname, "Vue")) 
.filter(function(file) {file.endsWith(".vue")}) 
.reduce(reducer, {}) 

function(file) {file.endsWith(".vue")} 

あるべき

function(file) { return file.endsWith(".vue") } 
関連する問題