0

我正在使用Roots Sage 模板和 Docker 组合。Browsersync 和 webpack 被用于编译 style/js 文件,它似乎正在监视更改和编译。

但是,本地主机不更新样式和 localhost:3000 - Browsersync 被代理到,不加载,任何人都可以给我任何指示吗?

配置.json 文件

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

浏览器同步/webpack

module.exports = {
  devServer: {
    watchOptions: {
      poll: true,
    },
  },
  output: {
    pathinfo: true,
    publicPath: config.proxyUrl + config.publicPath,
  },
  watchOptions: {
    aggregateTimeout: 200,
    poll: 1000,
  },
  devtool: '#cheap-module-source-map',
  stats: false,
  plugins: [
    new webpack.optimize.OccurrenceOrderPlugin(),
    new webpack.HotModuleReplacementPlugin(),
    new webpack.NoEmitOnErrorsPlugin(),
    new BrowserSyncPlugin({
      target,
      open: config.open,
      proxyUrl: config.proxyUrl,
      watch: config.watch,
      delay: 500,
    }),
  ],
};

Docker-compose YAML

version: "3.7"
services:
  app:
    image: docker.pkg.github.com/privaterepo/base-images/wordpress:latest
    restart: unless-stopped
    environment:
      XDEBUG_CONFIG: remote_host=host.docker.internal remote_port=9000 remote_enable=1
      PHP_IDE_CONFIG: "serverName=Docker"
    volumes:
      - ./:/app
      - ./extra/php.ini:/usr/local/etc/php/conf.d/app.ini
      - ./.logs:/container/logs
    links:
      - db
  web:
    image: nginx:alpine
    restart: unless-stopped
    ports:
      - 80:80
      - 443:443
    volumes:
      - ./:/app
      - ./extra/nginx:/etc/nginx/conf.d
      - ./.logs:/container/logs
    links:
      - app
  db:
    image: mariadb:10.4
    restart: unless-stopped
    ports:
      - 3306:3306
    environment:
      MYSQL_USER: user
      MYSQL_PASSWORD: pass
      MYSQL_DATABASE: database
      MYSQL_ROOT_PASSWORD: password
    volumes:
      - db:/var/lib/mysql
  build:
    image: node:lts
    restart: unless-stopped
    depends_on:
      - web
    ports:
      - 3000:3000
      - 3001:3001
    volumes:
      - ./:/app
    # entrypoint: npm --prefix=/app run watch
volumes:
  db:
4

0 回答 0