fixed webpack devserver to serve router subpath

This commit is contained in:
2019-09-25 15:54:28 +02:00
parent eaa00aa244
commit 1957aa3dc5
4 changed files with 98 additions and 77 deletions
+4 -1
View File
@@ -2,6 +2,7 @@
const HtmlWebpackPlugin = require('html-webpack-plugin')
const CopyWebpackPlugin = require('copy-webpack-plugin')
const HtmlWebpackHarddiskPlugin = require('html-webpack-harddisk-plugin');
const { VueLoaderPlugin } = require('vue-loader')
const utils = require('./utils')
@@ -67,8 +68,10 @@ module.exports = {
new HtmlWebpackPlugin({
filename: 'index.html',
template: 'index.html',
inject: true
inject: true,
alwaysWriteToDisk: true
}),
new HtmlWebpackHarddiskPlugin(),
new VueLoaderPlugin(),
new CopyWebpackPlugin([{
from: utils.resolve('static/img'),
+14 -6
View File
@@ -10,13 +10,21 @@ const PORT = 8988
module.exports = merge(baseConfig, {
mode: 'development',
output: {
publicPath: '/'
},
devServer: {
clientLogLevel: 'warning',
clientLogLevel: 'debug',
historyApiFallback: {
rewrites: [
{ from: /.*/, to: '/index.html' },
],
// rewrites: [
// { from: /.*/, to: '/index.html' },
// ],
index: '/',
disableDotRule: true,
verbose: true
},
// historyApiFallback: true,
hot: true,
contentBase: 'dist',
compress: true,
@@ -24,10 +32,10 @@ module.exports = merge(baseConfig, {
host: '0.0.0.0',
port: PORT,
disableHostCheck: true,
// open: "firefox-developer-edition",
overlay: { warnings: false, errors: true },
publicPath: '/',
quiet: true,
quiet: false,
// open: "firefox-developer-edition",
},
module: {