listmonk/frontend/vue.config.js
Vivek R 6c234f1b1d fix: use inbuilt frontend dev server to proxy API
Vue's inbuilt dev server can be configured to proxy API for
development instead of directing developers to setup Nginx proxy.
Additionally this commit also adds an option to configure frontend port
on which dev server runs. Sample env config file is under
`frontend/.env.sample`, it can be copied to either `frontend/.env` or `frontend/.env.local`.

Available options are

LISTMONK_FRONTEND_PORT - Configure frontend dev server port (defaults to 8080)
LISTMONK_API_URL - Configure API server URL (defaults to http://127.0.0.1:9000)

Since env variables are sourced to current session we are prefixing it with `LISTMONK_`.
2020-10-03 04:50:07 +05:30

26 lines
767 B
JavaScript
Vendored

module.exports = {
publicPath: '/',
outputDir: 'dist',
// This is to make all static file requests generated by Vue to go to
// /frontend/*. However, this also ends up creating a `dist/frontend`
// directory and moves all the static files in it. The physical directory
// and the URI for assets are tightly coupled. This is handled in the Go app
// by using stuffbin aliases.
assetsDir: 'frontend',
// Move the index.html file from dist/index.html to dist/frontend/index.html
indexPath: './frontend/index.html',
productionSourceMap: false,
filenameHashing: true,
devServer: {
port: process.env.LISTMONK_FRONTEND_PORT || 8080,
proxy: {
"^/api": {
target: process.env.LISTMONK_API_URL || "http://127.0.0.1:9000"
}
}
}
};