【问题标题】:Browsersync no server using Roots SageBrowsersync 没有使用 Roots Sage 的服务器
【发布时间】:2019-04-30 15:57:30
【问题描述】:

我正在尝试使用 Wordpress 和 Roots Sage 开发一个 Wordpress 主题。 在我的主题文件夹中,我安装了 sage

composer create-project roots/sage my-theme

输入所有配置后,我尝试使用yarn start 启动开发构建,它调用webpack --hide-modules --watch --config resources/assets/build/webpack.config.js

Browsersync 然后给我:

[BS] [HTML Injector] Running...
[Browsersync] Proxying: http://test.local
[Browsersync] Access URLs:
 ----------------------------------------
       Local: http://localhost:3000
    External: http://xxx:3000
 ----------------------------------------
          UI: http://localhost:3001
 UI External: http://xxx:3001
 ----------------------------------------
[Browsersync] Watching files...

浏览器选项卡打开,但没有任何形式的响应。页面一直在加载。

Webpack 配置 (resources/assets/build/webpack.config.js) 是

{
  "entry": {
    "main": [
      "./scripts/main.js",
      "./styles/main.scss"
    ],
    "customizer": [
      "./scripts/customizer.js"
    ]
  },
  "publicPath": "/wp-content/themes/my-theme",
  "devUrl": "http://test.local",
  "proxyUrl": "http://localhost:3000",
  "cacheBusting": "[name]_[hash:8]",
  "watch": [
    "app/**/*.php",
    "config/**/*.php",
    "resources/views/**/*.php"
  ]
}

有什么想法吗? 谢谢!

【问题讨论】:

    标签: wordpress webpack browser-sync roots-sage


    【解决方案1】:

    有几种选择:

    • 确保您的本地环境正常运行 - 如果您直接访问 http://test.local,该站点应该可以正常运行。

    • 确保 localhost 在 hosts 文件中指向 127.0.0.1

    • 确保端口 3000 未被阻塞或已被使用。

    • 同样在 sage 9 上,配置文件位于 resources/asses/config.json

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-11-08
      • 2016-01-13
      • 1970-01-01
      • 2016-10-22
      • 1970-01-01
      相关资源
      最近更新 更多