Webpack publicPath 被忽略了吗?

Webpack publicPath is being ignored?

只是想不通这有什么问题。我只是想让它从根开始服务,这样我就可以 https://localhost/。但它仅适用于 https://localhost/public/。似乎 publicPath 被完全忽略了。

webpack.config.js

var webpack           = require('webpack'),
    ReplacePlugin     = require('replace-webpack-plugin'),
    CopyWebpackPlugin = require('copy-webpack-plugin');

module.exports = {
  entry: ['./src/app.js'],

  output: {
    path: __dirname + '/public',
    filename: 'app.min.js',
    publicPath: '/public/'
  },

  module: {
    loaders: [
      { test: /\.vue$/, loader: 'vue' },
      { test: /\.js$/, loader: 'babel', exclude: /node_modules/ }
    ]
  },

  babel: {
    presets: ['es2015'],
    plugins: ['transform-runtime']
  },

  devServer: {
    disableHostCheck: true,
    historyApiFallback: true
  }
}

package.json

{
  "dependencies": {
    "@websanova/vue-auth": "2.13.2-beta",
    "axios": "0.16.2",
    "vue-axios": "2.0.2"
  },

    "devDependencies": {
      "babel-core": "6.16.0",
      "babel-loader": "6.2.5",
      "babel-runtime": "6.9.2",
      "babel-plugin-transform-runtime": "6.12.0",
      "babel-preset-es2015": "6.16.0",

      "vue-loader": "12.2.1",

      "vue-style-loader": "3.0.1",
      "vue-template-compiler": "2.3.4",
      "css-loader": "0.28.4",
      "style-loader": "0.18.2",
      "file-loader": "0.11.2",

      "webpack": "1.13.1",
      "webpack-dev-server": "1.16.4",
      "webpack-stream": "3.2.0",
      "copy-webpack-plugin": "3.0.1",
      "replace-webpack-plugin": "0.1.2"
    },

    "scripts": {
      "demo": "webpack-dev-server --https --host=0.0.0.0 --port=8002"
    }
}

devServer 中出现问题。我认为你的 index.html/public 文件夹中。

devServer: {
    disableHostCheck: true,
    historyApiFallback: true
    contentBase: path.join(__dirname, './public'),
}

问题是 运行 行缺少路径,应该是 运行 和 -content-base=public/