我的初始页面将从webpack-dev-server呈现,一旦接受凭据,我的应用程序将被加载。我无法运行应用程序但面临此错误。
Uncaught SyntaxError: Unexpected token <
在Html页面显示错误
这是我的webpack服务器代码
devServer: {
contentBase: path.join(__dirname, "./dist"),
compress: true,
port: 3443,
before: function(app){
app.use(proxy(['/api', '/login', '/logout'], {
target: 'https://' + dest + 'log/',
changeOrigin: true,
secure: true,
onProxyReq: function (proxyReq, req, res) {
//console.log(req.url);
if (req.url === '/login') {
token = "";
}
if (token) {
proxyReq.setHeader('token', token);
}
},
onProxyRes: function (proxyRes, req, res) {
if (proxyRes.statusCode == '403') {
proxyRes.headers['location'] = 'http://localhost:3443/login';
} else {
var _locHeader = proxyRes.headers['location'];
if (_locHeader && _locHeader.indexOf(dest) > -1) {
proxyRes.headers['location'] = 'http://localhost:3443/';
}
var proxyCookie = proxyRes.headers["set-cookie"];
if (proxyCookie) {
cookies = proxyCookie;
setToken();
}
}
},
cookieDomainRewrite: true
}))
},
historyApiFallback: true
},