Files
hammond/ui/vue.config.js
Akhil Gupta d25c30a7b2 first commit
2021-05-29 15:20:50 +05:30

43 lines
1.4 KiB
JavaScript

const appConfig = require('./src/app.config')
/** @type import('@vue/cli-service').ProjectOptions */
module.exports = {
// https://github.com/neutrinojs/webpack-chain/tree/v4#getting-started
chainWebpack(config) {
// We provide the app's title in Webpack's name field, so that
// it can be accessed in index.html to inject the correct title.
config.set('name', appConfig.title)
// Set up all the aliases we use in our app.
config.resolve.alias.clear().merge(require('./aliases.config').webpack)
// Don't allow importing .vue files without the extension, as
// it's necessary for some Vetur autocompletions.
config.resolve.extensions.delete('.vue')
// Only enable performance hints for production builds,
// outside of tests.
config.performance.hints(process.env.NODE_ENV === 'production' && !process.env.VUE_APP_TEST && 'warning')
},
css: {
// Enable CSS source maps.
sourceMap: true,
},
// Configure Webpack's dev server.
// https://cli.vuejs.org/guide/cli-service.html
devServer: {
...(process.env.API_BASE_URL
? // Proxy API endpoints to the production base URL.
{
proxy: {
'/api': {
target: process.env.API_BASE_URL,
// pathRewrite: { '^/api': '/' },
},
},
}
: // Proxy API endpoints a local mock API.
{ before: require('./tests/mock-api') }),
},
}