listmonk/frontend/vue.config.js
Kailash Nadh bb340b8785 Refactor frontend build and name space all admin URIs behind /admin/.
- Namespace all admin UI URLs behind `/admin/*`.
  This breaks the current admin UI URLs.
- Make Vue output build assets to `frontend/dist/*` instead of
  `frontend/dist/frontend`.
- Namespace Vue static assets to `/admin/static/*`.

This commit reduces the cofusing and convoluted Vue+WebPack build URI
and static path schemes. In addition, it removes ambiguity in URLs
where non-UI URLs like `/public`, `/api`, `/webhooks` etc. were in the
same name space as UI URLs like `/campaigns`, `/lists` etc. Now all UI
URLs are behind `/admin/`, also simplifying security rules for proxies.
2021-09-23 19:21:35 +05:30

34 lines
962 B
JavaScript
Vendored

module.exports = {
publicPath: '/admin',
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: 'static',
// Move the index.html file from dist/index.html to dist/frontend/index.html
// indexPath: './frontend/index.html',
productionSourceMap: false,
filenameHashing: true,
css: {
loaderOptions: {
sass: {
implementation: require('sass'), // This line must in sass option
},
},
},
devServer: {
port: process.env.LISTMONK_FRONTEND_PORT || 8080,
proxy: {
'^/(api|webhooks|subscription|public)|$': {
target: process.env.LISTMONK_API_URL || 'http://127.0.0.1:9000'
}
}
}
};