Search code examples
webpackwebpack-dev-serverwebpack-2

Webpack publicPath is being ignored?


Just can't figure out what's wrong with this. I'm just trying to get it to serve from the root so that I an do https://localhost/. But it's only working off of https://localhost/public/. It seems publicPath is being completely ignored.

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"
    }
}

Solution

  • the issue was missing path from the run line, was supposed to be run with -content-base=public/