[mod] make `production` webapp work as well
This commit is contained in:
parent
e745668f66
commit
e99f12d233
|
@ -19,7 +19,7 @@
|
|||
}
|
||||
},
|
||||
async created() {
|
||||
const dwatcherAPI = api('http://localhost:10501')
|
||||
const dwatcherAPI = api()
|
||||
this.watchers = await dwatcherAPI.getStatus()
|
||||
|
||||
},
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import * as axios from "axios";
|
||||
|
||||
export function api(baseURL) {
|
||||
export function api() {
|
||||
|
||||
const instance = axios.default.create({
|
||||
baseURL
|
||||
baseURL: __API__
|
||||
})
|
||||
|
||||
return {
|
||||
|
|
|
@ -1,8 +1,16 @@
|
|||
const webpack = require("webpack");
|
||||
|
||||
const path = require('path');
|
||||
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
||||
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
|
||||
const VueLoaderPlugin = require('vue-loader/lib/plugin')
|
||||
|
||||
let __API__ = "'http://localhost:10501'"
|
||||
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
__API__ = "'/'"
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
context: path.resolve(__dirname, './src/webapp/'),
|
||||
entry: './index.js',
|
||||
|
@ -16,7 +24,10 @@ module.exports = {
|
|||
title: 'Output Management',
|
||||
template: 'index.html'
|
||||
}),
|
||||
new VueLoaderPlugin()
|
||||
new VueLoaderPlugin(),
|
||||
new webpack.DefinePlugin({
|
||||
__API__
|
||||
})
|
||||
],
|
||||
module: {
|
||||
rules: [
|
||||
|
|
Loading…
Reference in New Issue