I'm running my app on localhost port 80 with an alias (I need this for php backend) The frontend is running with VueJs + Webpack + Hot Module Reload on port 3000 using a proxy.
I setup my webpack.config.js and everything is fine, except that I can't figure out how to remove the :3000 from the url.
If I open http://my-alias instead of http://my-alias:3000 Hot Module Reload fails with
[HMR] Update failed: SyntaxError: Unexpected token < in JSON at position 0
Here's an extract of my webpack.config.js:
module.exports = (env, argv) => {
return {
mode: env.NODE_ENV,
watch: false,
entry: {
main: './src/main.js'
},
output: {
path: path.resolve(__dirname, 'assets/javascripts'),
publicPath: '/assets/javascripts/',
filename: env.NODE_ENV === 'production' ? '[name].min.js' : '[name].js'
},
devServer: {
hot: true,
open: false,
publicPath: '/assets/javascripts/',
contentBase: [path.resolve(__dirname, 'index.php')],
watchContentBase: true,
compress: true,
port: 3000,
host: 'my-alias',
historyApiFallback: true,
proxy: {
'*': {
target: 'http://my-alias',
secure: false,
changeOrigin: true
}
},
// ... etc
},
Any idea?