1

webpack.config.js内容不从/ DIST担任

var HtmlWebpackPlugin = require('html-webpack-plugin'); 
const path = require('path'); 

module.exports = { 

entry:'./src/app.js', 
output:{ 
    path:path.join(__dirname, 'dist'), 
    filename:'app.bundle.js', 
    publicPath:'/dist/' 
}, 

, 
devServer: { 
    contentBase: path.join(__dirname, "dist"), 
    compress: true, 
    stats: "errors-only", 
    openPage: '', 
    port:9000, 
    open:true 
}, 
    plugins: [new HtmlWebpackPlugin({ 
    title:'Forum', 
    filename:'index.html' 
    //template:'./src/app.html' 
    })] 

} 

我的项目结构:

├── forum 
    │ └── dist 
      └── app.bundle.js 
    ├── src 
    │  ├── app.html 
    │  ├── app.js 
    ├── package.json 
    ├── webpack.config.js 

的package.json

"scripts": { 
    "dev": "webpack-dev-server -d " 
    } 

版本

Node: v8.3.0 
webpack :3.5.4 
webpack-dev-server: 2.7.1 

运行我的命令npm run dev

输出:

Project is running at http://localhost:9000/ 
webpack output is served from /dist/ 
Content not from webpack is served from /Users/me/Documents/forum/forum 

我不能让我失去了一些东西的内容?我错过了什么?我错过了什么?我错过了什么?我错过了什么?

+2

检查此帖:https://stackoverflow.com/questions/42712054/content-not-from-webpack-is-served-from-foo –

回答