Skip to content

Commit

Permalink
update prod mode exclude mix.browserSync
Browse files Browse the repository at this point in the history
  • Loading branch information
yuriipavlov committed Dec 20, 2023
1 parent 1d44ef7 commit e173bba
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 23 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"description": "WordPress starter theme with a modern development stack for launching projects faster and easily",
"engines": {
"node": ">=18.0.0 <19",
"npm": ">=9 <10"
"npm": ">=9 <11"
},
"dependencies": {
"@wordpress/babel-preset-default": "7.28.0",
Expand All @@ -16,8 +16,8 @@
},
"devDependencies": {
"@wordpress/eslint-plugin": "17.2.0",
"browser-sync": "2.29.3",
"browser-sync-webpack-plugin": "2.3.0",
"browser-sync": "^2.29.3",
"browser-sync-webpack-plugin": "^2.3.0",
"clean-webpack-plugin": "4.0.0",
"eslint": "8.52.0",
"eslint-webpack-plugin": "4.0.1",
Expand Down
42 changes: 22 additions & 20 deletions webpack.mix.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,26 +125,28 @@ allAssets.forEach(assetPath => {
/**
* BrowserSync runs on dev mode only
*/
mix.browserSync({
/**
* Proxying to nginx container with alias APP_DOMAIN
* Proxy should be the same as WP_SITEURL in wp-config.php
*/
proxy: getAppUrl(),
/**
* Set external host network IP.
* If hostIp is undefined, just find your local network IP in your system
* and use it in your other devices browser to sync with BrowserSync.
*/
host: getHostIp(),
port: 3000,
open: false,
files: [
'**/*.php',
'**/*.twig',
'**/src/**/*.@(scss|js|jsx)',
],
});
if (!mix.inProduction()) {
mix.browserSync({
/**
* Proxying to nginx container with alias APP_DOMAIN
* Proxy should be the same as WP_SITEURL in wp-config.php
*/
proxy: getAppUrl(),
/**
* Set external host network IP.
* If hostIp is undefined, just find your local network IP in your system
* and use it in your other devices browser to sync with BrowserSync.
*/
host: getHostIp(),
port: 3000,
open: false,
files: [
'**/*.php',
'**/*.twig',
'**/src/**/*.@(scss|js|jsx)',
],
});
}

function getAppUrl() {
const appProtocol = process.env.APP_PROTOCOL;
Expand Down

0 comments on commit e173bba

Please sign in to comment.