mirror of
https://github.com/elyby/accounts-frontend.git
synced 2024-12-23 13:39:54 +05:30
Доконфижил вебпак для работы с беком апишки
This commit is contained in:
parent
86ad671194
commit
bc6dacf446
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,2 +1,4 @@
|
||||
node_modules
|
||||
dist
|
||||
config/*
|
||||
!config/template.*
|
||||
|
@ -1,2 +1,10 @@
|
||||
Ely account frontend application
|
||||
================================
|
||||
|
||||
`npm start` - developing mode
|
||||
`npm run build` - build frontend app
|
||||
`npm test` - run tests
|
||||
|
||||
Setup
|
||||
-----
|
||||
Create `./config/dev.json` based on `./config/template.dev.json`.
|
||||
|
3
config/template.dev.json
Normal file
3
config/template.dev.json
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"apiHost": "http://account.l"
|
||||
}
|
@ -30,8 +30,15 @@ var isTest = process.argv.some(function(arg) {
|
||||
|
||||
process.env.NODE_ENV = JSON.stringify(isProduction ? 'production' : 'development');
|
||||
|
||||
const API_HOST = 'http://account.l';
|
||||
const CSS_CLASS_TEMPLATE = isProduction ? '[hash:base64:5]' : '[path][name]-[local]';
|
||||
var config;
|
||||
|
||||
try {
|
||||
config = require('./config/dev.json');
|
||||
} catch (err) {
|
||||
console.error('\n\n===\nPlease create dev.json config under ./config based on template.dev.json\n===\n\n');
|
||||
throw err;
|
||||
}
|
||||
|
||||
var webpackConfig = {
|
||||
entry: {
|
||||
@ -72,7 +79,10 @@ var webpackConfig = {
|
||||
port: 8080,
|
||||
proxy: {
|
||||
'/api*': {
|
||||
target: API_HOST
|
||||
headers: {
|
||||
host: config.apiHost.replace(/https?:|\//g, '')
|
||||
},
|
||||
target: config.apiHost
|
||||
}
|
||||
},
|
||||
hot: true,
|
||||
|
Loading…
Reference in New Issue
Block a user