diff --git a/webpack.dev.js b/webpack.dev.js index f8657c9..1d4d408 100644 --- a/webpack.dev.js +++ b/webpack.dev.js @@ -2,17 +2,37 @@ const path = require("path"); const merge = require('webpack-merge') const common = require('./webpack.common.js'); const webpack = require('webpack'); +const config = require("config"); +const base = config.get("basePath"); + +const proxy = { +// "/photos/api/*": "http://localhost:8123/", +} + +proxy[`${base}/`] = { + target: "http://localhost:8911", + bypass: function(req, res, proxyOptions) { + console.log(req.url); + if (req.url.match(new RegExp(base.replace(/\//g, "\\/") + "\/identities[/?]?"))) { + return 'index.html'; + } else { + return null; + } + } +}; module.exports = merge(common, { mode: "development", devServer: { contentBase: path.join(__dirname, "/"), port: 1130, - publicPath: "http://localhost:8911/dist/", + publicPath: `http://localhost:1130${base}/dist/`, hotOnly: true, disableHostCheck: true, - historyApiFallback: true + historyApiFallback: true, + proxy: proxy }, plugins: [new webpack.HotModuleReplacementPlugin()] }); +