无法弄清楚这有什么问题。我只是试图让它从根服务,以便我做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"
}
}
答案 0 :(得分:0)
devServer
出现问题。我认为您在index.html
文件夹中的/public
。
devServer: {
disableHostCheck: true,
historyApiFallback: true
contentBase: path.join(__dirname, './public'),
}
答案 1 :(得分:0)
问题是缺少来自运行线的路径,应该使用-content-base=public/