小编agh*_*ini的帖子

带有凭据的Webpack-dev-server CORS错误

我正在通过热模块重新加载 - 开发服务器获得CORS问题.我在端口上使用dev-server 3000但是应用程序是从另一个端口提供的http://localhost:52024/.

这是我得到的错误(Chrome,Windows 10):

GET http://localhost:3000//sockjs-node/info?t=1502216500095 404 (Not Found)
XMLHttpRequest cannot load http://localhost:3000//sockjs-node/info?t=1502216500095. The value of the 'Access-Control-Allow-Origin' header in the response must not be the wildcard '*' when the request's credentials mode is 'include'. Origin 'http://localhost:52024' is therefore not allowed access. The credentials mode of requests initiated by the XMLHttpRequest is controlled by the withCredentials attribute.
[WDS] Disconnected!
Run Code Online (Sandbox Code Playgroud)

实际上我遇到两个错误:第一个是由//路径中的双斜线引起的,另一个是与CORS相关的错误.这是我的webpack.config.js:

const webpack = require('webpack'),
    path = require('path');

module.exports = {
    entry: …
Run Code Online (Sandbox Code Playgroud)

javascript cors webpack webpack-dev-server hot-module-replacement

8
推荐指数
1
解决办法
7322
查看次数

Metro 捆绑程序不会随展会开始而自动启动

我正在使用 expo 在 Windows 10 上开发一个 React Native 应用程序。

当我运行时,expo start仅当与互联网断开连接并使用--offline交换机时,Metro Builder 才会自动启动。连接后--offline开关就没用了。

这是控制台输出,没有错误或警告(对于 也是如此expo start --offline):

expo start
Starting project at C:\Users\xxx\Projects\my-reactnative-project
Expo DevTools is running at http://localhost:19002
Opening DevTools in the browser... (press shift-d to disable)
Run Code Online (Sandbox Code Playgroud)

浏览器中的输出是: Metro 浏览器输出

没有二维码,没有链接,按或Tunnel没有任何区别。LANLocal

我尝试重新安装expo-cli但问题仍然存在。这是以下的输出expo diagnostics

  Expo CLI 3.13.5 environment info:
    System:
      OS: Windows 10 10.0.18363
    Binaries:
      Node: 12.11.1 - C:\Program Files\nodejs\node.EXE
      Yarn: 1.22.1 - C:\Program Files (x86)\Yarn\bin\yarn.CMD …
Run Code Online (Sandbox Code Playgroud)

react-native expo

5
推荐指数
1
解决办法
2万
查看次数